diff --git a/bugs.po b/bugs.po index 615b5d684a..4bd3a6eb49 100644 --- a/bugs.po +++ b/bugs.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-20 00:15+0000\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,8 +40,8 @@ msgstr "" #: ../../bugs.rst:11 msgid "" "It can be sometimes faster to fix bugs yourself and contribute patches to " -"Python as it streamlines the process and involves less people. Learn how " -"to :ref:`contribute `." +"Python as it streamlines the process and involves less people. Learn how to :" +"ref:`contribute `." msgstr "" "有時候自己直接修復錯誤並且送出一個修正給 Python 會比較快,因為這樣會加速流程" "而且不會困擾到太多人。學習如何\\ :ref:`貢獻給 Python `. If you have a suggestion on how to fix it, include that as " "well." msgstr "" -"如果你在這份說明文件中發現了錯誤並想要提出改進方案,請將錯誤報告提交到" -"\\ :ref:`錯誤追蹤系統 (issue tracker) `。如果你有相應的修正建議,請" -"一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 https://" -"github.com/python/python-docs-zh-tw/issues。)" +"如果你在這份說明文件中發現了錯誤並想要提出改進方案,請將錯誤報告提交到\\ :" +"ref:`錯誤追蹤系統 (issue tracker) `。如果你有相應的修正建" +"議,請一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 " +"https://github.com/python/python-docs-zh-tw/issues。)" -#: ../../bugs.rst:22 +#: ../../bugs.rst:24 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, submit the report to the `translation’s repository " +"`_ instead." +msgstr "" +"如果錯誤或建議的改進涉及此文件的翻譯,請將報告提交到\\ `翻譯存儲庫 " +"`_。" + +#: ../../bugs.rst:28 msgid "" "You can also open a discussion item on our `Documentation Discourse forum " "`_." @@ -71,33 +80,36 @@ msgstr "" "你也可以在我們的\\ `說明文件 Discourse 討論區 `_\\ 中新增一個討論事項。" -#: ../../bugs.rst:25 +#: ../../bugs.rst:31 msgid "" "If you find a bug in the theme (HTML / CSS / JavaScript) of the " "documentation, please submit a bug report on the `python-doc-theme issue " "tracker `_." msgstr "" +"如果你發現文件主題 (HTML / CSS / JavaScript) 中存在錯誤,請在 `python-doc-" +"theme 問題追蹤系統 `_\\ 上提交錯誤報" +"告。" -#: ../../bugs.rst:31 +#: ../../bugs.rst:37 msgid "`Documentation bugs`_" msgstr "`說明文件錯誤`_" -#: ../../bugs.rst:32 +#: ../../bugs.rst:38 msgid "" "A list of documentation bugs that have been submitted to the Python issue " "tracker." msgstr "一系列已被提交至 Python 問題追蹤系統的有關說明文件的錯誤。" -#: ../../bugs.rst:34 +#: ../../bugs.rst:40 msgid "`Issue Tracking `_" msgstr "`問題追蹤系統 `_" -#: ../../bugs.rst:35 +#: ../../bugs.rst:41 msgid "" "Overview of the process involved in reporting an improvement on the tracker." msgstr "在追蹤系統上回報改進建議的過程簡介。" -#: ../../bugs.rst:37 +#: ../../bugs.rst:43 msgid "" "`Helping with Documentation `_" @@ -105,20 +117,20 @@ msgstr "" "`貢獻說明文件 `_" -#: ../../bugs.rst:38 +#: ../../bugs.rst:44 msgid "" "Comprehensive guide for individuals that are interested in contributing to " "Python documentation." msgstr "給有意成為 Python 說明文件貢獻者的綜合指南。" -#: ../../bugs.rst:40 +#: ../../bugs.rst:46 msgid "" "`Documentation Translations `_" msgstr "" "`說明文件翻譯 `_" -#: ../../bugs.rst:41 +#: ../../bugs.rst:47 msgid "" "A list of GitHub pages for documentation translation and their primary " "contacts." @@ -126,11 +138,11 @@ msgstr "" "一份 GitHub 網頁的清單,裡面有各個說明文件翻譯團隊的連結,以及他們的主要聯絡" "人。" -#: ../../bugs.rst:47 +#: ../../bugs.rst:53 msgid "Using the Python issue tracker" msgstr "使用 Python 問題追蹤系統" -#: ../../bugs.rst:49 +#: ../../bugs.rst:55 msgid "" "Issue reports for Python itself should be submitted via the GitHub issues " "tracker (https://github.com/python/cpython/issues). The GitHub issues " @@ -141,7 +153,7 @@ msgstr "" "python/cpython/issues) 提交。這個 GitHub 問題追蹤系統提供了一個網頁表單,可以" "輸入並提交相關資訊給開發者。" -#: ../../bugs.rst:54 +#: ../../bugs.rst:60 msgid "" "The first step in filing a report is to determine whether the problem has " "already been reported. The advantage in doing so, aside from saving the " @@ -156,7 +168,7 @@ msgstr "" "本中修正了這個問題,也有可能需要更詳細的資訊(在這種情況下,如果可以,非常歡" "迎你提供資訊!)。要確認是否重複回報,請使用頁面頂端的搜尋框來搜尋追蹤系統。" -#: ../../bugs.rst:61 +#: ../../bugs.rst:67 msgid "" "If the problem you're reporting is not already in the list, log in to " "GitHub. If you don't already have a GitHub account, create a new account " @@ -166,7 +178,7 @@ msgstr "" "如果你想回報的問題還沒有在問題列表出現過,請登入 GitHub。如果你還沒有 GitHub " "帳戶,請點選「Sign up」連結來建立一個新的帳戶。你無法以匿名方式提交錯誤報告。" -#: ../../bugs.rst:66 +#: ../../bugs.rst:72 msgid "" "Being now logged in, you can submit an issue. Click on the \"New issue\" " "button in the top bar to report a new issue." @@ -174,18 +186,18 @@ msgstr "" "如果已經登入,那你就可以提交問題了。請點選列表頂端區域的「New issue」按鈕,來" "回報一個新的問題。" -#: ../../bugs.rst:69 +#: ../../bugs.rst:75 msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "提交的表單中有兩個欄位,「Title」及「Comment」。" -#: ../../bugs.rst:71 +#: ../../bugs.rst:77 msgid "" "For the \"Title\" field, enter a *very* short description of the problem; " "fewer than ten words is good." msgstr "" "在「Title」欄位,輸入對該問題\\ *非常*\\ 簡短的描述;最好少於十個單字。" -#: ../../bugs.rst:74 +#: ../../bugs.rst:80 msgid "" "In the \"Comment\" field, describe the problem in detail, including what you " "expected to happen and what did happen. Be sure to include whether any " @@ -196,7 +208,7 @@ msgstr "" "確定說明中包含了涉及到的任何擴充模組,以及你當時所使用的硬體和軟體平台(視情" "況而定,可以附上版本資訊)。" -#: ../../bugs.rst:79 +#: ../../bugs.rst:85 msgid "" "Each issue report will be reviewed by a developer who will determine what " "needs to be done to correct the problem. You will receive an update each " @@ -205,15 +217,15 @@ msgstr "" "每一份問題報告都會被一位開發人員查核,並由他決定要做出什麼變更來修正這個問" "題。每當該問題有修正動作時,你會收到更新回報。" -#: ../../bugs.rst:86 +#: ../../bugs.rst:92 msgid "" "`How to Report Bugs Effectively `_" msgstr "" -"`如何有效地回報錯誤 `_" +"`如何有效地回報錯誤 `_" -#: ../../bugs.rst:87 +#: ../../bugs.rst:93 msgid "" "Article which goes into some detail about how to create a useful bug report. " "This describes what kind of information is useful and why it is useful." @@ -221,14 +233,14 @@ msgstr "" "這篇文章詳細說明如何建立一份有用的錯誤報告。它描述了什麼樣的資訊是有用的,以" "及這些資訊為什麼有用。" -#: ../../bugs.rst:90 +#: ../../bugs.rst:96 msgid "" "`Bug Writing Guidelines `_" msgstr "" "`錯誤撰寫指南 `_" -#: ../../bugs.rst:91 +#: ../../bugs.rst:97 msgid "" "Information about writing a good bug report. Some of this is specific to " "the Mozilla project, but describes general good practices." @@ -236,11 +248,11 @@ msgstr "" "撰寫一份優良錯誤報告的相關資訊。部分的文章內容是針對 Mozilla 專案,但它也描述" "了通用的好習慣。" -#: ../../bugs.rst:97 +#: ../../bugs.rst:103 msgid "Getting started contributing to Python yourself" msgstr "開始讓自己貢獻 Python" -#: ../../bugs.rst:99 +#: ../../bugs.rst:105 msgid "" "Beyond just reporting bugs that you find, you are also welcome to submit " "patches to fix them. You can find more information on how to get started " @@ -252,14 +264,3 @@ msgstr "" "你可以在 `Python 開發者指南`_\\ 中找到如何開始修補 Python 的更多資訊。如果你" "有任何問題,`核心導師郵寄清單`_\\ 是一個友善的地方,你可以在那裡得到,關於 " "Python 修正錯誤的過程中,所有問題的答案。" - -#~ msgid "" -#~ "If you're short on time, you can also email documentation bug reports to " -#~ "docs@python.org (behavioral bugs can be sent to python-list@python.org). " -#~ "'docs@' is a mailing list run by volunteers; your request will be " -#~ "noticed, though it may take a while to be processed." -#~ msgstr "" -#~ "如果你的時間有限,也可以將說明文件的錯誤報告以電子郵件寄到 " -#~ "docs@python.org\\ (程式碼執行的錯誤可以寄到 python-list@python.org)。" -#~ "「docs@」是一個由志工們所運行的郵寄清單;你的請求會被注意到,但可能需要一" -#~ "些時間才會被處理。" diff --git a/c-api/arg.po b/c-api/arg.po index 61c618181f..faecd8282d 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-25 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-" @@ -25,17 +25,17 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" "These functions are useful when creating your own extension functions and " -"methods. Additional information and examples are available " -"in :ref:`extending-index`." +"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 @@ -56,7 +56,7 @@ msgstr "" #: ../../c-api/arg.rst:33 msgid "Strings and buffers" -msgstr "" +msgstr "字串與緩衝區" #: ../../c-api/arg.rst:37 msgid "" @@ -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 has 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:648 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:642 msgid "``h`` (:class:`int`) [short int]" @@ -527,7 +526,7 @@ msgstr "" #: ../../c-api/arg.rst:273 ../../c-api/arg.rst:283 msgid "Use :meth:`~object.__index__` if available." -msgstr "" +msgstr "如有提供則使用 :meth:`~object.__index__`。" #: ../../c-api/arg.rst:276 ../../c-api/arg.rst:660 msgid "``L`` (:class:`int`) [long long]" @@ -616,9 +615,9 @@ msgstr "``O`` (object) [PyObject \\*]" #: ../../c-api/arg.rst:313 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:319 @@ -652,12 +651,12 @@ msgstr "status = converter(object, address);" #: ../../c-api/arg.rst:336 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:345 @@ -671,8 +670,8 @@ msgstr "" #: ../../c-api/arg.rst:351 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:354 @@ -707,8 +706,8 @@ msgstr "" #: ../../c-api/arg.rst:372 msgid "" "If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or " -"a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or a :" +"term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " "object must be a Python tuple. The *converter* for the ``O&`` format unit in " "*items* must not store a borrowed buffer or a borrowed reference." msgstr "" @@ -773,8 +772,8 @@ msgstr "``;``" #: ../../c-api/arg.rst:411 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:415 @@ -833,9 +832,9 @@ msgstr "" #: ../../c-api/arg.rst:462 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:466 @@ -846,9 +845,9 @@ msgstr "新增對\\ :ref:`僅限位置參數 `\\ 的 #: ../../c-api/arg.rst:470 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:479 @@ -986,10 +985,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:589 @@ -1165,16 +1164,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:687 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:691 msgid "Convert a C :c:expr:`double` to a Python floating-point number." @@ -1197,9 +1196,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:709 @@ -1228,9 +1227,9 @@ msgstr "``O&`` (object) [*converter*, *anything*]" #: ../../c-api/arg.rst:718 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:723 diff --git a/c-api/buffer.po b/c-api/buffer.po index a83b0f40b0..2307ed3d90 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -732,7 +732,7 @@ msgstr "" #: ../../c-api/buffer.rst:525 msgid "``0`` is returned on success, ``-1`` on error." -msgstr "" +msgstr "成功時回傳 ``0``,錯誤時回傳 ``-1``。" #: ../../c-api/buffer.rst:529 msgid "" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index f11d449223..1489b716d5 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -129,20 +129,20 @@ msgstr "" #: ../../c-api/gcsupport.rst:73 ../../c-api/gcsupport.rst:97 msgid ":c:func:`PyObject_GC_Del`" -msgstr "" +msgstr ":c:func:`PyObject_GC_Del`" #: ../../c-api/gcsupport.rst:74 msgid ":c:macro:`PyObject_New`" -msgstr "" +msgstr ":c:macro:`PyObject_New`" #: ../../c-api/gcsupport.rst:75 ../../c-api/gcsupport.rst:99 #: ../../c-api/gcsupport.rst:193 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/gcsupport.rst:76 ../../c-api/gcsupport.rst:100 msgid ":c:member:`~PyTypeObject.tp_alloc`" -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/gcsupport.rst:81 msgid "" @@ -152,7 +152,7 @@ msgstr "" #: ../../c-api/gcsupport.rst:98 msgid ":c:macro:`PyObject_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_NewVar`" #: ../../c-api/gcsupport.rst:105 msgid "" @@ -262,15 +262,15 @@ msgstr "" #: ../../c-api/gcsupport.rst:191 msgid ":c:macro:`PyObject_GC_New`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_New`" #: ../../c-api/gcsupport.rst:192 msgid ":c:macro:`PyObject_GC_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_NewVar`" #: ../../c-api/gcsupport.rst:194 msgid ":c:member:`~PyTypeObject.tp_free`" -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_free`" #: ../../c-api/gcsupport.rst:199 msgid "" diff --git a/c-api/init.po b/c-api/init.po index 3b5b946f41..3de24c2095 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-10 00:15+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-" @@ -1573,7 +1573,7 @@ msgid "" "deadlock ensues. *tstate* will be attached upon returning." msgstr "" -#: ../../c-api/init.rst:1244 ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1244 ../../c-api/init.rst:1631 msgid "" "Calling this function from a thread when the runtime is finalizing will hang " "the thread until the program exits, even if the thread was not created by " @@ -1581,8 +1581,8 @@ msgid "" "details." msgstr "" -#: ../../c-api/init.rst:1249 ../../c-api/init.rst:1320 -#: ../../c-api/init.rst:1625 +#: ../../c-api/init.rst:1249 ../../c-api/init.rst:1333 +#: ../../c-api/init.rst:1641 msgid "" "Hangs the current thread, rather than terminating it, if called while the " "interpreter is finalizing." @@ -1625,6 +1625,11 @@ msgid "" "will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" +#: ../../c-api/init.rst:1282 +#, fuzzy +msgid ":c:func:`PyEval_ReleaseThread`" +msgstr "PyEval_ReleaseThread()" + #: ../../c-api/init.rst:1285 msgid "" "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " @@ -1639,6 +1644,20 @@ msgstr "" #: ../../c-api/init.rst:1294 msgid "" +"The type of the value returned by :c:func:`PyGILState_Ensure` and passed to :" +"c:func:`PyGILState_Release`." +msgstr "" + +#: ../../c-api/init.rst:1299 +msgid "The GIL was already held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: ../../c-api/init.rst:1303 +msgid "The GIL was not held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: ../../c-api/init.rst:1307 +msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the :term:`attached thread state`. " "This may be called as many times as desired by a thread as long as each call " @@ -1650,7 +1669,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1317 msgid "" "The return value is an opaque \"handle\" to the :term:`attached thread " "state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:" @@ -1660,14 +1679,14 @@ msgid "" "to :c:func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1324 msgid "" "When the function returns, there will be an :term:`attached thread state` " "and the thread will be able to call arbitrary Python code. Failure is a " "fatal error." msgstr "" -#: ../../c-api/init.rst:1315 +#: ../../c-api/init.rst:1328 msgid "" "Calling this function when the runtime is finalizing is unsafe. Doing so " "will either hang the thread until the program ends, or fully crash the " @@ -1675,7 +1694,7 @@ msgid "" "finalization` for more details." msgstr "" -#: ../../c-api/init.rst:1326 +#: ../../c-api/init.rst:1339 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1683,13 +1702,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1344 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1336 +#: ../../c-api/init.rst:1349 msgid "" "Get the :term:`attached thread state` for this thread. May return ``NULL`` " "if no GILState API has been used on the current thread. Note that the main " @@ -1697,15 +1716,19 @@ msgid "" "been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1342 +#: ../../c-api/init.rst:1355 msgid "" -"This function does not account for :term:`thread states ` " -"created by something other than :c:func:`PyGILState_Ensure` (such as :c:func:" -"`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` or :c:func:" +"This function may return non-``NULL`` even when the :term:`thread state` is " +"detached. Prefer :c:func:`PyThreadState_Get` or :c:func:" "`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1351 +#: ../../c-api/init.rst:1360 +#, fuzzy +msgid ":c:func:`PyThreadState_Get`" +msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" + +#: ../../c-api/init.rst:1364 msgid "" "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " "otherwise. This function can be called from any thread at any time. Only if " @@ -1717,20 +1740,20 @@ msgid "" "differently." msgstr "" -#: ../../c-api/init.rst:1361 +#: ../../c-api/init.rst:1374 msgid "" "If the current Python process has ever created a subinterpreter, this " "function will *always* return ``1``. Prefer :c:func:" "`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1368 +#: ../../c-api/init.rst:1381 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1374 +#: ../../c-api/init.rst:1387 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1738,7 +1761,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1395 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1746,42 +1769,42 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1403 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1396 +#: ../../c-api/init.rst:1409 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1402 +#: ../../c-api/init.rst:1415 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1404 +#: ../../c-api/init.rst:1417 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1406 +#: ../../c-api/init.rst:1419 msgid "" ":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:" "`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1413 +#: ../../c-api/init.rst:1426 msgid "" "Create a new interpreter state object. An :term:`attached thread state` is " "not needed, but may optionally exist if it is necessary to serialize calls " "to this function." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1430 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1789,13 +1812,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1422 +#: ../../c-api/init.rst:1435 msgid "" "Reset all information in an interpreter state object. There must be an :" "term:`attached thread state` for the interpreter." msgstr "" -#: ../../c-api/init.rst:1425 +#: ../../c-api/init.rst:1438 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1803,7 +1826,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1430 +#: ../../c-api/init.rst:1443 msgid "" "Destroy an interpreter state object. There **should not** be an :term:" "`attached thread state` for the target interpreter. The interpreter state " @@ -1811,165 +1834,172 @@ msgid "" "`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1450 msgid "" "Create a new thread state object belonging to the given interpreter object. " "An :term:`attached thread state` is not needed." msgstr "" -#: ../../c-api/init.rst:1442 +#: ../../c-api/init.rst:1455 msgid "" "Reset all information in a :term:`thread state` object. *tstate* must be :" "term:`attached `" msgstr "" -#: ../../c-api/init.rst:1445 +#: ../../c-api/init.rst:1458 msgid "" -"This function now calls the :c:member:`PyThreadState.on_delete` callback. " +"This function now calls the :c:member:`!PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1449 -msgid "The :c:member:`PyThreadState.on_delete` callback was removed." +#: ../../c-api/init.rst:1462 +#, fuzzy +msgid "The :c:member:`!PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1455 +#: ../../c-api/init.rst:1468 msgid "" "Destroy a :term:`thread state` object. *tstate* should not be :term:" "`attached ` to any thread. *tstate* must have been " "reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1463 +#: ../../c-api/init.rst:1476 msgid "" "Detach the :term:`attached thread state` (which must have been reset with a " "previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" -#: ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1479 msgid "" "No :term:`thread state` will be :term:`attached ` " "upon returning." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1484 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1473 +#: ../../c-api/init.rst:1486 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1476 +#: ../../c-api/init.rst:1489 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1478 ../../c-api/init.rst:1487 -#: ../../c-api/init.rst:1496 +#: ../../c-api/init.rst:1491 ../../c-api/init.rst:1500 +#: ../../c-api/init.rst:1509 msgid "" "*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1498 msgid "" "Get the unique :term:`thread state` identifier of the Python thread state " "*tstate*." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1507 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1503 +#: ../../c-api/init.rst:1516 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1518 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1512 +#: ../../c-api/init.rst:1525 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1515 +#: ../../c-api/init.rst:1528 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1536 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1538 msgid "" "Issue a fatal error if there no :term:`attached thread state`. It cannot " "return NULL." msgstr "" -#: ../../c-api/init.rst:1533 +#: ../../c-api/init.rst:1546 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1536 ../../c-api/init.rst:2125 -#: ../../c-api/init.rst:2132 ../../c-api/init.rst:2151 -#: ../../c-api/init.rst:2158 +#: ../../c-api/init.rst:1549 ../../c-api/init.rst:2145 +#: ../../c-api/init.rst:2152 ../../c-api/init.rst:2171 +#: ../../c-api/init.rst:2178 msgid "The caller must have an :term:`attached thread state`." msgstr "呼叫者必須擁有一個 :term:`attached thread state`。" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1556 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1547 +#: ../../c-api/init.rst:1560 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1555 +#: ../../c-api/init.rst:1563 +msgid "" +"The returned dictionary is borrowed from the interpreter and is valid until " +"interpreter shutdown." +msgstr "" + +#: ../../c-api/init.rst:1571 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1573 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1560 +#: ../../c-api/init.rst:1576 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1563 +#: ../../c-api/init.rst:1579 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1568 +#: ../../c-api/init.rst:1584 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1570 ../../c-api/init.rst:1578 +#: ../../c-api/init.rst:1586 ../../c-api/init.rst:1594 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1576 +#: ../../c-api/init.rst:1592 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1585 +#: ../../c-api/init.rst:1601 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1979,7 +2009,7 @@ msgid "" "thread state is attached." msgstr "" -#: ../../c-api/init.rst:1595 +#: ../../c-api/init.rst:1611 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1991,54 +2021,54 @@ msgid "" "is cleared. This raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1603 +#: ../../c-api/init.rst:1619 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1609 +#: ../../c-api/init.rst:1625 msgid "" ":term:`Attach ` *tstate* to the current thread, which " "must not be ``NULL`` or already :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1628 msgid "" "The calling thread must not already have an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1620 +#: ../../c-api/init.rst:1636 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1629 +#: ../../c-api/init.rst:1645 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1651 msgid "" "Detach the :term:`attached thread state`. The *tstate* argument, which must " "not be ``NULL``, is only used to check that it represents the :term:" "`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1640 +#: ../../c-api/init.rst:1656 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1647 +#: ../../c-api/init.rst:1663 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1649 +#: ../../c-api/init.rst:1665 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -2046,7 +2076,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1654 +#: ../../c-api/init.rst:1670 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -2057,31 +2087,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1661 +#: ../../c-api/init.rst:1677 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1667 +#: ../../c-api/init.rst:1683 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1673 +#: ../../c-api/init.rst:1689 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1693 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1681 +#: ../../c-api/init.rst:1697 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -2089,44 +2119,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1705 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1693 +#: ../../c-api/init.rst:1709 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1698 +#: ../../c-api/init.rst:1714 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1703 +#: ../../c-api/init.rst:1719 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1724 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1714 +#: ../../c-api/init.rst:1730 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1721 +#: ../../c-api/init.rst:1737 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -2135,37 +2165,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1728 +#: ../../c-api/init.rst:1744 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1733 +#: ../../c-api/init.rst:1749 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1740 +#: ../../c-api/init.rst:1756 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1744 +#: ../../c-api/init.rst:1760 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1748 +#: ../../c-api/init.rst:1764 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1766 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1764 +#: ../../c-api/init.rst:1780 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -2178,13 +2208,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1774 +#: ../../c-api/init.rst:1790 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1777 +#: ../../c-api/init.rst:1793 msgid "" "Upon success, *tstate_p* will be set to the first :term:`thread state` " "created in the new sub-interpreter. This thread state is :term:`attached " @@ -2195,7 +2225,7 @@ msgid "" "not exist." msgstr "" -#: ../../c-api/init.rst:1786 +#: ../../c-api/init.rst:1802 msgid "" "Like all other Python/C API functions, an :term:`attached thread state` must " "be present before calling this function, but it might be detached upon " @@ -2208,13 +2238,13 @@ msgid "" "will remain detached." msgstr "" -#: ../../c-api/init.rst:1797 +#: ../../c-api/init.rst:1813 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1800 +#: ../../c-api/init.rst:1816 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2246,7 +2276,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1815 +#: ../../c-api/init.rst:1831 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2254,11 +2284,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1824 +#: ../../c-api/init.rst:1840 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1826 +#: ../../c-api/init.rst:1842 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2266,7 +2296,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1832 +#: ../../c-api/init.rst:1848 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2278,7 +2308,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1843 +#: ../../c-api/init.rst:1859 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2288,7 +2318,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1863 +#: ../../c-api/init.rst:1879 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2297,7 +2327,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1891 msgid "" "Destroy the (sub-)interpreter represented by the given :term:`thread state`. " "The given thread state must be :term:`attached `. " @@ -2305,17 +2335,17 @@ msgid "" "thread states associated with this interpreter are destroyed." msgstr "" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1896 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1903 msgid "A Per-Interpreter GIL" msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1905 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2327,7 +2357,7 @@ msgid "" "just using threads. (See :pep:`554` and :pep:`684`.)" msgstr "" -#: ../../c-api/init.rst:1899 +#: ../../c-api/init.rst:1915 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2341,7 +2371,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1910 +#: ../../c-api/init.rst:1926 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2349,7 +2379,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1915 +#: ../../c-api/init.rst:1931 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2359,11 +2389,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1942 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1944 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2376,7 +2406,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1938 +#: ../../c-api/init.rst:1954 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2385,7 +2415,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1944 +#: ../../c-api/init.rst:1960 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2397,25 +2427,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1955 +#: ../../c-api/init.rst:1971 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1957 +#: ../../c-api/init.rst:1973 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1964 +#: ../../c-api/init.rst:1980 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1968 +#: ../../c-api/init.rst:1984 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2423,17 +2453,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1973 +#: ../../c-api/init.rst:1989 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1974 +#: ../../c-api/init.rst:1990 msgid "" "with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1977 +#: ../../c-api/init.rst:1993 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2441,7 +2471,7 @@ msgid "" "if the :term:`thread state ` is detached." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:1998 msgid "" "This function doesn't need an :term:`attached thread state`. However, to " "call this function in a subinterpreter, the caller must have an :term:" @@ -2449,7 +2479,7 @@ msgid "" "be called from the wrong interpreter." msgstr "" -#: ../../c-api/init.rst:1987 +#: ../../c-api/init.rst:2003 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2459,7 +2489,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1996 +#: ../../c-api/init.rst:2012 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2467,18 +2497,23 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:2005 +#: ../../c-api/init.rst:2018 +msgid "" +"This function now always schedules *func* to be run in the main interpreter." +msgstr "" + +#: ../../c-api/init.rst:2025 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:2010 +#: ../../c-api/init.rst:2030 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:2014 +#: ../../c-api/init.rst:2034 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2488,7 +2523,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:2024 +#: ../../c-api/init.rst:2044 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2500,66 +2535,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2053 msgid "Value of *what*" msgstr "*what* 的值" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2053 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2055 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:2035 ../../c-api/init.rst:2040 -#: ../../c-api/init.rst:2051 +#: ../../c-api/init.rst:2055 ../../c-api/init.rst:2060 +#: ../../c-api/init.rst:2071 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2057 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2057 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:2040 +#: ../../c-api/init.rst:2060 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2062 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2062 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:2045 +#: ../../c-api/init.rst:2065 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:2045 ../../c-api/init.rst:2047 -#: ../../c-api/init.rst:2049 +#: ../../c-api/init.rst:2065 ../../c-api/init.rst:2067 +#: ../../c-api/init.rst:2069 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:2047 +#: ../../c-api/init.rst:2067 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:2049 +#: ../../c-api/init.rst:2069 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:2051 +#: ../../c-api/init.rst:2071 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:2056 +#: ../../c-api/init.rst:2076 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2568,7 +2603,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:2065 +#: ../../c-api/init.rst:2085 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2580,7 +2615,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:2076 +#: ../../c-api/init.rst:2096 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2588,31 +2623,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:2084 +#: ../../c-api/init.rst:2104 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2110 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2116 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:2102 +#: ../../c-api/init.rst:2122 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2108 +#: ../../c-api/init.rst:2128 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2620,7 +2655,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2116 +#: ../../c-api/init.rst:2136 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2630,24 +2665,24 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2143 msgid "See also the :func:`sys.setprofile` function." msgstr "另請參閱 :func:`sys.setprofile` 函式。" -#: ../../c-api/init.rst:2129 +#: ../../c-api/init.rst:2149 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2134 +#: ../../c-api/init.rst:2154 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2142 +#: ../../c-api/init.rst:2162 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2658,28 +2693,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2149 +#: ../../c-api/init.rst:2169 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2155 +#: ../../c-api/init.rst:2175 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2160 +#: ../../c-api/init.rst:2180 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2166 +#: ../../c-api/init.rst:2186 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2192 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2689,19 +2724,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2182 +#: ../../c-api/init.rst:2202 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2187 +#: ../../c-api/init.rst:2207 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2192 +#: ../../c-api/init.rst:2212 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2710,7 +2745,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2198 +#: ../../c-api/init.rst:2218 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2718,12 +2753,12 @@ msgid "" "active every time the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2203 ../../c-api/init.rst:2214 +#: ../../c-api/init.rst:2223 ../../c-api/init.rst:2234 msgid "" "There must be an :term:`attached thread state` when calling this function." msgstr "" -#: ../../c-api/init.rst:2209 +#: ../../c-api/init.rst:2229 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2731,48 +2766,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2221 +#: ../../c-api/init.rst:2241 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2226 +#: ../../c-api/init.rst:2246 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2231 +#: ../../c-api/init.rst:2251 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2236 +#: ../../c-api/init.rst:2256 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2241 +#: ../../c-api/init.rst:2261 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2247 +#: ../../c-api/init.rst:2267 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2273 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2260 +#: ../../c-api/init.rst:2280 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2264 +#: ../../c-api/init.rst:2284 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2782,19 +2817,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2271 +#: ../../c-api/init.rst:2291 msgid "" "A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they suppl their own locking." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2294 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2278 +#: ../../c-api/init.rst:2298 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2802,22 +2837,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2286 +#: ../../c-api/init.rst:2306 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2288 +#: ../../c-api/init.rst:2308 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2294 +#: ../../c-api/init.rst:2314 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2319 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2825,52 +2860,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2304 +#: ../../c-api/init.rst:2324 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2310 +#: ../../c-api/init.rst:2330 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2315 +#: ../../c-api/init.rst:2335 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2317 +#: ../../c-api/init.rst:2337 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2324 +#: ../../c-api/init.rst:2344 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2331 +#: ../../c-api/init.rst:2351 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2337 +#: ../../c-api/init.rst:2357 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2342 +#: ../../c-api/init.rst:2362 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2344 +#: ../../c-api/init.rst:2364 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2878,13 +2913,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2352 +#: ../../c-api/init.rst:2372 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2358 +#: ../../c-api/init.rst:2378 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2893,7 +2928,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2367 +#: ../../c-api/init.rst:2387 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2902,31 +2937,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2376 +#: ../../c-api/init.rst:2396 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2383 +#: ../../c-api/init.rst:2403 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2391 +#: ../../c-api/init.rst:2411 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2393 +#: ../../c-api/init.rst:2413 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2398 +#: ../../c-api/init.rst:2418 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2935,45 +2970,45 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2403 +#: ../../c-api/init.rst:2423 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2414 +#: ../../c-api/init.rst:2434 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2416 +#: ../../c-api/init.rst:2436 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2420 +#: ../../c-api/init.rst:2440 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2423 +#: ../../c-api/init.rst:2443 msgid "PyMutex mutex = {0};" msgstr "PyMutex mutex = {0};" -#: ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2445 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2451 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2439 +#: ../../c-api/init.rst:2459 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " @@ -2981,28 +3016,28 @@ msgid "" "exists." msgstr "" -#: ../../c-api/init.rst:2447 +#: ../../c-api/init.rst:2467 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2454 +#: ../../c-api/init.rst:2474 msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." msgstr "" -#: ../../c-api/init.rst:2458 +#: ../../c-api/init.rst:2478 msgid "" "This function is intended for use in assertions and debugging only and " "should not be used to make concurrency control decisions, as the lock state " "may change immediately after the check." msgstr "" -#: ../../c-api/init.rst:2467 +#: ../../c-api/init.rst:2487 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2469 +#: ../../c-api/init.rst:2489 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -3010,7 +3045,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2474 +#: ../../c-api/init.rst:2494 msgid "" "Critical sections are intended to be used for custom types implemented in C-" "API extensions. They should generally not be used with built-in types like :" @@ -3019,7 +3054,7 @@ msgid "" "`PyDict_Next`, which requires critical section to be acquired externally." msgstr "" -#: ../../c-api/init.rst:2481 +#: ../../c-api/init.rst:2501 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections, hence, they do not provide exclusive access such as provided by " @@ -3030,7 +3065,7 @@ msgid "" "threads can acquire the per-object lock for the same object." msgstr "" -#: ../../c-api/init.rst:2489 +#: ../../c-api/init.rst:2509 msgid "" "Variants that accept :c:type:`PyMutex` pointers rather than Python objects " "are also available. Use these variants to start a critical section in a " @@ -3039,7 +3074,7 @@ msgid "" "needs to call into the C API in a manner that might lead to deadlocks." msgstr "" -#: ../../c-api/init.rst:2495 +#: ../../c-api/init.rst:2515 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -3047,7 +3082,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2502 +#: ../../c-api/init.rst:2522 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -3056,11 +3091,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2508 +#: ../../c-api/init.rst:2528 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../c-api/init.rst:2510 +#: ../../c-api/init.rst:2530 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -3080,7 +3115,7 @@ msgstr "" " Py_RETURN_NONE;\n" "}" -#: ../../c-api/init.rst:2519 +#: ../../c-api/init.rst:2539 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -3090,19 +3125,19 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2527 +#: ../../c-api/init.rst:2547 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2530 ../../c-api/init.rst:2544 -#: ../../c-api/init.rst:2561 ../../c-api/init.rst:2576 -#: ../../c-api/init.rst:2590 ../../c-api/init.rst:2607 +#: ../../c-api/init.rst:2550 ../../c-api/init.rst:2564 +#: ../../c-api/init.rst:2581 ../../c-api/init.rst:2596 +#: ../../c-api/init.rst:2610 ../../c-api/init.rst:2627 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2532 +#: ../../c-api/init.rst:2552 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3112,15 +3147,15 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2536 ../../c-api/init.rst:2582 +#: ../../c-api/init.rst:2556 ../../c-api/init.rst:2602 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2542 +#: ../../c-api/init.rst:2562 msgid "Locks the mutex *m* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2546 +#: ../../c-api/init.rst:2566 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3130,21 +3165,21 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_BeginMutex(&_py_cs, m)" -#: ../../c-api/init.rst:2550 +#: ../../c-api/init.rst:2570 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " "the argument of the macro - it must be a :c:type:`PyMutex` pointer." msgstr "" -#: ../../c-api/init.rst:2553 ../../c-api/init.rst:2599 +#: ../../c-api/init.rst:2573 ../../c-api/init.rst:2619 msgid "On the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2559 +#: ../../c-api/init.rst:2579 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2563 +#: ../../c-api/init.rst:2583 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" @@ -3152,18 +3187,18 @@ msgstr "" " PyCriticalSection_End(&_py_cs);\n" "}" -#: ../../c-api/init.rst:2566 ../../c-api/init.rst:2612 +#: ../../c-api/init.rst:2586 ../../c-api/init.rst:2632 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2572 +#: ../../c-api/init.rst:2592 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2578 +#: ../../c-api/init.rst:2598 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3173,11 +3208,11 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2588 +#: ../../c-api/init.rst:2608 msgid "Locks the mutexes *m1* and *m2* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2592 +#: ../../c-api/init.rst:2612 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3187,17 +3222,17 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" -#: ../../c-api/init.rst:2596 +#: ../../c-api/init.rst:2616 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " "the arguments of the macro - they must be :c:type:`PyMutex` pointers." msgstr "" -#: ../../c-api/init.rst:2605 +#: ../../c-api/init.rst:2625 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2609 +#: ../../c-api/init.rst:2629 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -3218,19 +3253,19 @@ msgid "path (in module sys)" msgstr "path(sys 模組中)" #: ../../c-api/init.rst:350 ../../c-api/init.rst:712 ../../c-api/init.rst:1228 -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "sys" msgstr "sys" @@ -3242,7 +3277,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1820 ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1836 ../../c-api/init.rst:1889 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3338,23 +3373,23 @@ msgstr "PyEval_RestoreThread()" msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1836 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1866 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index bef46bbdf1..b45fcc2319 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -3171,7 +3171,7 @@ msgstr "" #: ../../c-api/init_config.rst:2183 msgid "Python Path Configuration" -msgstr "" +msgstr "Python 路徑配置" #: ../../c-api/init_config.rst:2185 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" @@ -3290,7 +3290,7 @@ msgstr "" #: ../../c-api/init_config.rst:2233 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" -msgstr "" +msgstr ":c:func:`Py_RunMain` 和 :c:func:`Py_Main` 會修改 :data:`sys.path`:" #: ../../c-api/init_config.rst:2235 msgid "" diff --git a/c-api/memory.po b/c-api/memory.po index 3074068991..d19ecbf292 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -1022,15 +1022,15 @@ msgstr "" #: ../../c-api/memory.rst:667 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," -msgstr "" +msgstr "Windows 上的 :c:func:`!VirtualAlloc` 和 :c:func:`!VirtualFree`," #: ../../c-api/memory.rst:668 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," -msgstr "" +msgstr "如果可用,則使用 :c:func:`!mmap` 和 :c:func:`!munmap`," #: ../../c-api/memory.rst:669 msgid ":c:func:`malloc` and :c:func:`free` otherwise." -msgstr "" +msgstr "否則使用 :c:func:`malloc` 和 :c:func:`free`。" #: ../../c-api/memory.rst:671 msgid "" diff --git a/c-api/module.po b/c-api/module.po index 02c45934aa..f00c8f3e2d 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-25 00:15+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,22 +36,21 @@ 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:416 -#: ../../c-api/module.rst:443 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:420 +#: ../../c-api/module.rst:447 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -68,6 +67,7 @@ msgid "" "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " "string instead of a Unicode object." msgstr "" +"類似於 :c:func:`PyModule_NewObject`,但名稱是以 UTF-8 編碼的字串,而非 Unicode 物件。" #: ../../c-api/module.rst:65 msgid "" @@ -80,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 @@ -96,12 +96,13 @@ msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" +"類似於 :c:func:`PyModule_GetNameObject`,但回傳以 ``'utf-8'`` 編碼的名稱。" #: ../../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 @@ -110,51 +111,59 @@ msgid "" "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: ../../c-api/module.rst:112 +#: ../../c-api/module.rst:105 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." +"On error, return ``NULL`` with an exception set. Use :c:func:" +"`PyErr_Occurred` to tell this case apart from a mising :c:type:`!" +"PyModuleDef`." msgstr "" -#: ../../c-api/module.rst:122 +#: ../../c-api/module.rst:116 +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." +msgstr "" + +#: ../../c-api/module.rst:126 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." msgstr "" +"類似於 :c:func:`PyModule_GetFilenameObject`,但回傳以 'utf-8' 編碼的檔案名稱。" -#: ../../c-api/module.rst:125 +#: ../../c-api/module.rst:129 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: ../../c-api/module.rst:133 +#: ../../c-api/module.rst:137 msgid "Module definitions" msgstr "模組定義" -#: ../../c-api/module.rst:135 +#: ../../c-api/module.rst:139 msgid "" "The functions in the previous section work on any module object, including " "modules imported from Python code." msgstr "" -#: ../../c-api/module.rst:138 +#: ../../c-api/module.rst:142 msgid "" -"Modules defined using the C API typically use a *module " -"definition*, :c:type:`PyModuleDef` -- a statically allocated, constant " -"“description\" of how a module should be created." +"Modules defined using the C API typically use a *module definition*, :c:type:" +"`PyModuleDef` -- a statically allocated, constant “description\" of how a " +"module should be created." msgstr "" -#: ../../c-api/module.rst:142 +#: ../../c-api/module.rst:146 msgid "" "The definition is usually used to define an extension's “main” module object " "(see :ref:`extension-modules` for details). It is also used to :ref:`create " "extension modules dynamically `." msgstr "" -#: ../../c-api/module.rst:147 +#: ../../c-api/module.rst:151 msgid "" "Unlike :c:func:`PyModule_New`, the definition allows management of *module " "state* -- a piece of memory that is allocated and cleared together with the " @@ -162,7 +171,7 @@ msgid "" "replace or delete data stored in module state." msgstr "" -#: ../../c-api/module.rst:155 +#: ../../c-api/module.rst:159 msgid "" "The module definition struct, which holds all information needed to create a " "module object. This structure must be statically allocated (or be otherwise " @@ -170,42 +179,42 @@ msgid "" "there is only one variable of this type for each extension module." msgstr "" -#: ../../c-api/module.rst:163 +#: ../../c-api/module.rst:167 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:167 +#: ../../c-api/module.rst:171 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:171 +#: ../../c-api/module.rst:175 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:176 +#: ../../c-api/module.rst:180 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:180 +#: ../../c-api/module.rst:184 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:184 +#: ../../c-api/module.rst:188 msgid "" "Setting it to a non-negative value means that the module can be re-" "initialized and specifies the additional amount of memory it requires for " "its state." msgstr "" -#: ../../c-api/module.rst:188 +#: ../../c-api/module.rst:192 msgid "" "Setting ``m_size`` to ``-1`` means that the module does not support sub-" "interpreters, because it has global state. Negative ``m_size`` is only " @@ -214,59 +223,59 @@ msgid "" "dynamic>`." msgstr "" -#: ../../c-api/module.rst:194 +#: ../../c-api/module.rst:198 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:198 +#: ../../c-api/module.rst:202 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:203 +#: ../../c-api/module.rst:207 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " "``{0, NULL}`` entry. When using legacy single-phase initialization, " "*m_slots* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:209 +#: ../../c-api/module.rst:213 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" +"在 3.5 版本之前,這個成員總是被設為 ``NULL``,並被定義為:" -#: ../../c-api/module.rst:216 +#: ../../c-api/module.rst:220 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:219 ../../c-api/module.rst:234 -#: ../../c-api/module.rst:255 +#: ../../c-api/module.rst:223 ../../c-api/module.rst:238 +#: ../../c-api/module.rst:259 msgid "" "This function is not 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, 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:226 ../../c-api/module.rst:247 -#: ../../c-api/module.rst:262 +#: ../../c-api/module.rst:230 ../../c-api/module.rst:251 +#: ../../c-api/module.rst:266 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:231 +#: ../../c-api/module.rst:235 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:241 +#: ../../c-api/module.rst:245 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -275,55 +284,55 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:252 +#: ../../c-api/module.rst:256 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:267 +#: ../../c-api/module.rst:271 msgid "Module slots" msgstr "模組槽 (Module slots)" -#: ../../c-api/module.rst:273 +#: ../../c-api/module.rst:277 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:277 +#: ../../c-api/module.rst:281 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:281 +#: ../../c-api/module.rst:285 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:285 +#: ../../c-api/module.rst:289 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:292 +#: ../../c-api/module.rst:296 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:297 +#: ../../c-api/module.rst:301 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:301 +#: ../../c-api/module.rst:305 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:304 +#: ../../c-api/module.rst:308 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -332,17 +341,17 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:310 +#: ../../c-api/module.rst:314 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:319 +#: ../../c-api/module.rst:323 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -350,61 +359,61 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:328 +#: ../../c-api/module.rst:332 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:333 ../../c-api/module.rst:366 +#: ../../c-api/module.rst:337 ../../c-api/module.rst:370 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:339 +#: ../../c-api/module.rst:343 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:343 +#: ../../c-api/module.rst:347 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:349 +#: ../../c-api/module.rst:353 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:353 +#: ../../c-api/module.rst:357 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:356 +#: ../../c-api/module.rst:360 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:359 +#: ../../c-api/module.rst:363 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:372 +#: ../../c-api/module.rst:376 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:377 +#: ../../c-api/module.rst:381 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:379 +#: ../../c-api/module.rst:383 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -412,22 +421,22 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:384 +#: ../../c-api/module.rst:388 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:386 +#: ../../c-api/module.rst:390 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:395 +#: ../../c-api/module.rst:399 msgid "Creating extension modules dynamically" msgstr "" -#: ../../c-api/module.rst:397 +#: ../../c-api/module.rst:401 msgid "" "The following functions may be used to create a module outside of an " "extension's :ref:`initialization function `. They are " @@ -435,42 +444,41 @@ msgid "" "initialization>`." msgstr "" -#: ../../c-api/module.rst:404 +#: ../../c-api/module.rst:408 msgid "" "Create a new module object, given the definition in *def*. This is a macro " -"that calls :c:func:`PyModule_Create2` with *module_api_version* set " -"to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if " -"using the :ref:`limited API `." +"that calls :c:func:`PyModule_Create2` with *module_api_version* set to :c:" +"macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if using " +"the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:412 +#: ../../c-api/module.rst:416 msgid "" "Create a new module object, given the definition in *def*, assuming the API " "version *module_api_version*. If that version does not match the version of " "the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -#: ../../c-api/module.rst:418 +#: ../../c-api/module.rst:422 msgid "" "This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " "member of *def* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:424 +#: ../../c-api/module.rst:428 msgid "" "Most uses of this function should be using :c:func:`PyModule_Create` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:429 +#: ../../c-api/module.rst:433 msgid "" "This macro calls :c:func:`PyModule_FromDefAndSpec2` with " -"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or " -"to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." +"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:" +"`PYTHON_ABI_VERSION` if using the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:438 +#: ../../c-api/module.rst:442 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -478,42 +486,42 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:445 +#: ../../c-api/module.rst:449 msgid "" "Note that this does not process execution slots (:c:data:`Py_mod_exec`). " "Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " "fully initialize a module." msgstr "" -#: ../../c-api/module.rst:451 +#: ../../c-api/module.rst:455 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:458 +#: ../../c-api/module.rst:462 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:464 +#: ../../c-api/module.rst:468 msgid "The C API version. Defined for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:466 ../../c-api/module.rst:473 +#: ../../c-api/module.rst:470 ../../c-api/module.rst:477 msgid "" "Currently, this constant is not updated in new Python versions, and is not " "useful for versioning. This may change in the future." msgstr "" -#: ../../c-api/module.rst:471 +#: ../../c-api/module.rst:475 msgid "Defined as ``3`` for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:478 +#: ../../c-api/module.rst:482 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:480 +#: ../../c-api/module.rst:484 msgid "" "The following functions are provided to help initialize a module state. They " "are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " @@ -521,23 +529,23 @@ msgid "" "phase-initialization>`, or code that creates modules dynamically." msgstr "" -#: ../../c-api/module.rst:488 +#: ../../c-api/module.rst:492 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:491 +#: ../../c-api/module.rst:495 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:493 ../../c-api/module.rst:544 -#: ../../c-api/module.rst:571 +#: ../../c-api/module.rst:497 ../../c-api/module.rst:548 +#: ../../c-api/module.rst:575 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:495 +#: ../../c-api/module.rst:499 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -563,20 +571,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:507 +#: ../../c-api/module.rst:511 msgid "" "To be convenient, the function accepts ``NULL`` *value* with an exception " "set. In this case, return ``-1`` and just leave the raised exception " "unchanged." msgstr "" -#: ../../c-api/module.rst:511 +#: ../../c-api/module.rst:515 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:514 +#: ../../c-api/module.rst:518 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -596,23 +604,23 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:523 +#: ../../c-api/module.rst:527 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:526 +#: ../../c-api/module.rst:530 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:539 +#: ../../c-api/module.rst:543 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -620,39 +628,43 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:550 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" -#: ../../c-api/module.rst:555 +#: ../../c-api/module.rst:559 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" +"類似於 :c:func:`PyModule_AddObjectRef`,但在成功時(如果回傳 ``0``)會偷走對 *value* 的參照。" -#: ../../c-api/module.rst:558 +#: ../../c-api/module.rst:562 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:565 +#: ../../c-api/module.rst:569 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:568 +#: ../../c-api/module.rst:572 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:573 +#: ../../c-api/module.rst:577 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -666,24 +678,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:586 +#: ../../c-api/module.rst:590 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." -msgstr "" +msgstr ":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" -#: ../../c-api/module.rst:591 +#: ../../c-api/module.rst:595 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:595 +#: ../../c-api/module.rst:599 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:601 +#: ../../c-api/module.rst:605 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -691,14 +703,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:606 +#: ../../c-api/module.rst:610 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:613 +#: ../../c-api/module.rst:617 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -706,11 +718,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:621 +#: ../../c-api/module.rst:625 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:625 +#: ../../c-api/module.rst:629 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -718,7 +730,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:635 +#: ../../c-api/module.rst:639 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -727,7 +739,7 @@ msgid "" "first parameter, making them similar to instance methods on Python classes)." msgstr "" -#: ../../c-api/module.rst:641 +#: ../../c-api/module.rst:645 msgid "" "This function is called automatically when creating a module from " "``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " @@ -736,7 +748,7 @@ msgid "" "that case they should call this function directly." msgstr "" -#: ../../c-api/module.rst:652 +#: ../../c-api/module.rst:656 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef`` (such as when " @@ -744,23 +756,23 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:661 +#: ../../c-api/module.rst:665 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " -"It must be called during *module*'s initialization function when " -"using :ref:`single-phase-initialization`. If this function is not called " -"during module initialization, the import machinery assumes the module does " -"not support running without the GIL. This function is only available in " -"Python builds configured with :option:`--disable-gil`. Return ``-1`` with an " -"exception set on error, ``0`` on success." +"It must be called during *module*'s initialization function when using :ref:" +"`single-phase-initialization`. If this function is not called during module " +"initialization, the import machinery assumes the module does not support " +"running without the GIL. This function is only available in Python builds " +"configured with :option:`--disable-gil`. Return ``-1`` with an exception set " +"on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:675 +#: ../../c-api/module.rst:679 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:677 +#: ../../c-api/module.rst:681 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -768,14 +780,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:686 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:687 +#: ../../c-api/module.rst:691 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -784,18 +796,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:694 +#: ../../c-api/module.rst:698 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:697 +#: ../../c-api/module.rst:701 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:699 +#: ../../c-api/module.rst:703 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -807,21 +819,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:708 +#: ../../c-api/module.rst:712 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 +#: ../../c-api/module.rst:715 ../../c-api/module.rst:726 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:713 +#: ../../c-api/module.rst:717 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:719 +#: ../../c-api/module.rst:723 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -847,7 +859,7 @@ msgstr "__name__(模組屬性)" msgid "__doc__ (module attribute)" msgstr "__doc__(模組屬性)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:108 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:112 msgid "__file__ (module attribute)" msgstr "__file__(模組屬性)" @@ -863,12 +875,6 @@ msgstr "__loader__(模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__(模組屬性)" -#: ../../c-api/module.rst:77 ../../c-api/module.rst:108 +#: ../../c-api/module.rst:77 ../../c-api/module.rst:112 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" - -#~ msgid "Initializing C modules" -#~ msgstr "初始化 C 模組" - -#~ msgid "See :PEP:`489` for more details on multi-phase initialization." -#~ msgstr "更多關於多階段初始化的詳細資訊,請參閱 :pep:`489`。" diff --git a/c-api/object.po b/c-api/object.po index 29f4268ec2..2c7d919add 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 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-" @@ -134,8 +134,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 @@ -153,16 +153,15 @@ 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,27 +194,26 @@ 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 "" @@ -228,37 +226,36 @@ 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 @@ -272,11 +269,10 @@ 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 @@ -296,8 +292,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 @@ -310,10 +306,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 @@ -337,18 +333,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 @@ -392,12 +388,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 @@ -443,10 +439,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 @@ -483,8 +479,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 @@ -509,8 +505,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 @@ -609,9 +605,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 @@ -620,8 +616,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 @@ -635,17 +631,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 @@ -672,14 +668,14 @@ 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 @@ -688,8 +684,8 @@ 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 @@ -697,14 +693,14 @@ 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`。" +"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設定 :c:macro:" +"`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" #: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:579 ../../c-api/object.rst:588 +#: ../../c-api/object.rst:579 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." @@ -714,6 +710,12 @@ msgstr "" msgid "Clear the managed dictionary of *obj*." msgstr "" +#: ../../c-api/object.rst:588 +msgid "" +"This function must only be called in a clear function of the type which has " +"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + #: ../../c-api/object.rst:595 msgid "" "Enable `deferred reference counting ` references when possible, which " -"means that a reference count of ``1`` by itself does not guarantee that a " -"function argument uniquely referenced." +"modifications when loading objects onto the operands stack by :term:" +"`borrowing ` references when possible, which means that " +"a reference count of ``1`` by itself does not guarantee that a function " +"argument uniquely referenced." msgstr "" #: ../../c-api/object.rst:635 @@ -920,10 +922,10 @@ msgstr "" #: ../../c-api/object.rst:750 msgid "" -"On a :term:`free threaded ` build, this checks if " -"*op*'s :term:`reference count` is equal to one and additionally checks if " -"*op* is only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** " -"thread-safe on free threaded builds; prefer this function." +"On a :term:`free threaded ` build, this checks if *op*'s :" +"term:`reference count` is equal to one and additionally checks if *op* is " +"only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-" +"safe on free threaded builds; prefer this function." msgstr "" #: ../../c-api/object.rst:755 diff --git a/c-api/type.po b/c-api/type.po index a3c70ae54d..d83b5ad7cf 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -642,7 +642,7 @@ msgstr "" #: ../../c-api/type.rst:549 msgid ":c:data:`Py_tp_token`" -msgstr "" +msgstr ":c:data:`Py_tp_token`" #: ../../c-api/type.rst:551 msgid "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a77ed49a21..c1c5a71066 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 00:14+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-" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use " -"of :c:type:`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use of :c:type:" +"`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -63,7 +63,7 @@ msgstr "" #: ../../c-api/typeobj.rst:40 ../../c-api/typeobj.rst:201 msgid ":ref:`Type `" -msgstr "" +msgstr ":ref:`Type `" #: ../../c-api/typeobj.rst:40 msgid "special methods/attrs" @@ -1180,9 +1180,9 @@ msgstr "" #: ../../c-api/typeobj.rst:476 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found " -"in :file:`Include/cpython/object.h`. For convenience of reference, this " -"repeats the definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found in :file:" +"`Include/cpython/object.h`. For convenience of reference, this repeats the " +"definition found there:" msgstr "" #: ../../c-api/typeobj.rst:482 @@ -1290,12 +1290,11 @@ msgstr "" #: ../../c-api/typeobj.rst:488 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. " -"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " -"(created by :c:func:`!type_new`, usually called from a class statement). " -"Note that :c:data:`PyType_Type` (the metatype) " -"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " -"instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. The :" +"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" +"c:func:`!type_new`, usually called from a class statement). Note that :c:" +"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." +"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" @@ -1307,10 +1306,10 @@ msgstr ":c:member:`PyObject.ob_refcnt`" msgid "" "The type object's reference count is initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects " -"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " -"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." +"objects `, the type's instances (objects whose :c:member:" +"`~PyObject.ob_type` points back to the type) do *not* count as references. " +"But for :ref:`dynamically allocated type objects `, the " +"instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 @@ -1375,11 +1374,10 @@ msgstr "Foo_Type.ob_type = &PyType_Type;" #: ../../c-api/typeobj.rst:522 msgid "" -"This should be done before any instances of the type are " -"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " -"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " -"field of the base class. :c:func:`PyType_Ready` will not change this field " -"if it is non-zero." +"This should be done before any instances of the type are created. :c:func:" +"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " +"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " +"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:809 @@ -1418,9 +1416,8 @@ msgstr "" 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 " -"\"Default\" section. (Note that many fields set " -"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " -"defaults.)" +"\"Default\" section. (Note that many fields set on :c:data:" +"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" #: ../../c-api/typeobj.rst:558 @@ -1430,9 +1427,9 @@ msgid "" "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in " -"subpackage :mod:`!Q` in package :mod:`!P` should have " -"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" +"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." +"tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" #: ../../c-api/typeobj.rst:566 @@ -1453,18 +1450,18 @@ msgstr "" #: ../../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:`~type.__module__` attribute is undefined (unless explicitly set " -"in the dictionary, as explained above). This means your type will be " -"impossible to pickle. Additionally, it will not be listed in module " -"documentations created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " +"dictionary, as explained above). This means your type will be impossible to " +"pickle. Additionally, it will not be listed in module documentations " +"created with pydoc." msgstr "" #: ../../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`)." +"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:595 @@ -1474,20 +1471,20 @@ msgstr "" #: ../../c-api/typeobj.rst:597 msgid "" -"There are two kinds of types: types with fixed-length instances have a " -"zero :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`.)" +"There are two kinds of types: types with fixed-length instances have a zero :" +"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: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:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " -"is the \"length\" of the object." +"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:`!" +"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " +"\"length\" of the object." msgstr "" #: ../../c-api/typeobj.rst:609 @@ -1497,14 +1494,14 @@ msgid "" "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`." +"underlying storage and its size should be accessed using :c:func:" +"`PyLong_Export`." msgstr "" #: ../../c-api/typeobj.rst:619 msgid "" -"The :c:member:`~PyVarObject.ob_size` field should be accessed using " -"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +"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:622 @@ -1512,34 +1509,33 @@ msgid "" "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.)" +"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 "" -"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." +"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`." +"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: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." +"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 @@ -1550,8 +1546,8 @@ 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`." +"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 @@ -1609,11 +1605,10 @@ msgstr "" #: ../../c-api/typeobj.rst:688 msgid "" -"If you may call functions that may set the error indicator, you must " -"use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` to ensure you don't clobber a " -"preexisting error indicator (the deallocation could have occurred while " -"processing a different error):" +"If you may call functions that may set the error indicator, you must use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` to " +"ensure you don't clobber a preexisting error indicator (the deallocation " +"could have occurred while processing a different error):" msgstr "" #: ../../c-api/typeobj.rst:693 @@ -1642,15 +1637,15 @@ msgstr "" #: ../../c-api/typeobj.rst:710 msgid "" "Python will destroy an object immediately or some time after the final " -"reference to the object is deleted, unless its finalizer " -"(:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object." +"reference to the object is deleted, unless its finalizer (:c:member:" +"`~PyTypeObject.tp_finalize`) subsequently resurrects the object." msgstr "" #: ../../c-api/typeobj.rst:714 msgid "" -"An object will not be destroyed while it is being automatically finalized " -"(:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared " -"(:c:member:`~PyTypeObject.tp_clear`)." +"An object will not be destroyed while it is being automatically finalized (:" +"c:member:`~PyTypeObject.tp_finalize`) or automatically cleared (:c:member:" +"`~PyTypeObject.tp_clear`)." msgstr "" #: ../../c-api/typeobj.rst:718 @@ -1676,18 +1671,18 @@ msgstr "" #: ../../c-api/typeobj.rst:730 msgid "" -"It is permissible to call :c:member:`~PyTypeObject.tp_clear` " -"from :c:member:`!tp_dealloc` to reduce code duplication and to guarantee " -"that the object is always cleared before destruction. Beware " -"that :c:member:`!tp_clear` might have already been called." +"It is permissible to call :c:member:`~PyTypeObject.tp_clear` from :c:member:" +"`!tp_dealloc` to reduce code duplication and to guarantee that the object is " +"always cleared before destruction. Beware that :c:member:`!tp_clear` might " +"have already been called." msgstr "" #: ../../c-api/typeobj.rst:735 msgid "" "If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object " -"(via :c:func:`Py_DECREF`) after calling the type deallocator. See the " -"example code below.::" +"deallocator should release the owned reference to its type object (via :c:" +"func:`Py_DECREF`) after calling the type deallocator. See the example code " +"below.::" msgstr "" #: ../../c-api/typeobj.rst:740 @@ -1806,10 +1801,10 @@ msgstr "" #: ../../c-api/typeobj.rst:831 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 *vectorcallfunc* function. This can be done by setting " -"*tp_call* to :c:func:`PyVectorcall_Call`." +"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 " +"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" +"`PyVectorcall_Call`." msgstr "" #: ../../c-api/typeobj.rst:838 @@ -1821,19 +1816,19 @@ msgstr "" #: ../../c-api/typeobj.rst:844 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"` to implement the vectorcall protocol. When a user " -"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " -"likely making it inconsistent with the vectorcall function. Since 3.12, " -"setting ``__call__`` will disable vectorcall optimization by clearing " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"` to implement the vectorcall protocol. When a user sets :attr:" +"`~object.__call__` in Python code, only *tp_call* is updated, likely making " +"it inconsistent with the vectorcall function. Since 3.12, setting " +"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" #: ../../c-api/typeobj.rst:854 msgid "" -"This field is always inherited. However, " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " -"it's not set, then the subclass won't use :ref:`vectorcall `, " -"except when :c:func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " +"then the subclass won't use :ref:`vectorcall `, except when :c:" +"func:`PyVectorcall_Call` is explicitly called." msgstr "" #: ../../c-api/typeobj.rst:863 @@ -1847,21 +1842,24 @@ msgid "" "but taking a C string instead of a Python string object to give the " "attribute name." msgstr "" +"此欄位已被棄用。當它被定義時,它應該指向一個與 :c:member:`~PyTypeObject.tp_getattro` " +"行為相同但使用 C 字串而非 Python 字串物件來提供屬性名稱的函式。" #: ../../c-api/typeobj.rst:871 ../../c-api/typeobj.rst:1067 -msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." +"tp_getattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" +"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." +"tp_getattro`" #: ../../c-api/typeobj.rst:873 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:880 ../../c-api/typeobj.rst:1080 @@ -1876,21 +1874,24 @@ msgid "" "but taking a C string instead of a Python string object to give the " "attribute name." msgstr "" +"此欄位已被棄用。當它被定義時,它應該指向一個與 :c:member:`~PyTypeObject.tp_setattro` " +"行為相同但使用 C 字串而非 Python 字串物件來提供屬性名稱的函式。" #: ../../c-api/typeobj.rst:888 ../../c-api/typeobj.rst:1093 -msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." +"tp_setattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" +"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." +"tp_setattro`" #: ../../c-api/typeobj.rst:890 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:897 @@ -1902,7 +1903,7 @@ msgstr "" #: ../../c-api/typeobj.rst:901 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." -msgstr "" +msgstr "以前稱為 ``tp_compare`` 和 ``tp_reserved``。" #: ../../c-api/typeobj.rst:906 msgid "" @@ -1912,13 +1913,13 @@ msgstr "" #: ../../c-api/typeobj.rst:914 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`repr`." +"An optional pointer to a function that implements the built-in function :" +"func:`repr`." msgstr "" #: ../../c-api/typeobj.rst:917 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Repr` 相同: ::" #: ../../c-api/typeobj.rst:919 msgid "PyObject *tp_repr(PyObject *self);" @@ -1992,13 +1993,13 @@ msgstr "" #: ../../c-api/typeobj.rst:979 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`hash`." +"An optional pointer to a function that implements the built-in function :" +"func:`hash`." msgstr "" #: ../../c-api/typeobj.rst:982 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Hash` 相同: ::" #: ../../c-api/typeobj.rst:984 msgid "Py_hash_t tp_hash(PyObject *);" @@ -2014,9 +2015,9 @@ msgstr "" #: ../../c-api/typeobj.rst:990 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:`TypeError`. This is the same as setting it " -"to :c:func:`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object raises :exc:" +"`TypeError`. This is the same as setting it to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" #: ../../c-api/typeobj.rst:994 @@ -2026,29 +2027,30 @@ msgid "" "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set " -"to :c:func:`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" #: ../../c-api/typeobj.rst:1004 ../../c-api/typeobj.rst:1769 -msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." +"tp_richcompare`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" +"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." +"tp_richcompare`" #: ../../c-api/typeobj.rst:1006 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " -"of :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash`, when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" +"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " +"are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1013 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." -msgstr "" +msgstr ":c:data:`PyBaseObject_Type` 會使用 :c:func:`PyObject_GenericHash`。" #: ../../c-api/typeobj.rst:1018 msgid "" @@ -2063,16 +2065,16 @@ msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" #: ../../c-api/typeobj.rst:1031 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 the constructor for that type. This constructor " -"calls :c:func:`PyObject_Str` to do the actual work, " -"and :c:func:`PyObject_Str` will call this handler.)" +"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 " +"the constructor for that type. This constructor calls :c:func:" +"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " +"this handler.)" msgstr "" #: ../../c-api/typeobj.rst:1036 msgid "The signature is the same as for :c:func:`PyObject_Str`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Str` 相同: ::" #: ../../c-api/typeobj.rst:1038 msgid "PyObject *tp_str(PyObject *self);" @@ -2098,7 +2100,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1058 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_GetAttr` 相同: ::" #: ../../c-api/typeobj.rst:1060 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" @@ -2106,28 +2108,27 @@ msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" #: ../../c-api/typeobj.rst:1062 msgid "" -"It is usually convenient to set this field " -"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " -"looking for object attributes." +"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:1069 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1075 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." -msgstr "" +msgstr ":c:data:`PyBaseObject_Type` 會使用 :c:func:`PyObject_GenericGetAttr`。" #: ../../c-api/typeobj.rst:1082 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_SetAttr` 相同: ::" #: ../../c-api/typeobj.rst:1084 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" @@ -2136,19 +2137,18 @@ msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" #: ../../c-api/typeobj.rst:1086 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:`PyObject_GenericSetAttr`, which implements the normal way of " -"setting object attributes." +"supported. It is usually convenient to set this field to :c:func:" +"`PyObject_GenericSetAttr`, which implements the normal way of setting object " +"attributes." msgstr "" #: ../../c-api/typeobj.rst:1095 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1101 @@ -2172,12 +2172,12 @@ msgstr "" 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 " -"fields in the type object (or in the extension structures referenced " -"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " -"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " -"always present are valid; if such a flag bit is clear, the type fields it " -"guards must not be accessed and must be considered to have a zero or " -"``NULL`` value instead." +"fields in the type object (or in the extension structures referenced via :c:" +"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." +"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" +"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " +"valid; if such a flag bit is clear, the type fields it guards must not be " +"accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" #: ../../c-api/typeobj.rst:1128 @@ -2189,11 +2189,10 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. 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` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values." +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" +"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " +"the subtype exist and have ``NULL`` values." msgstr "" #: ../../c-api/typeobj.rst:1143 @@ -2211,10 +2210,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1150 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.tp_flags` field. The " -"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " -"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." +"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." +"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " +"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" +"zero." msgstr "" #: ../../c-api/typeobj.rst:1157 @@ -2225,9 +2224,9 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " -"also :ref:`support garbage collection ` as they " -"can form a reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" +"`support garbage collection ` as they can form a " +"reference cycle with their own module object." msgstr "" #: ../../c-api/typeobj.rst:1168 ../../c-api/typeobj.rst:1179 @@ -2245,8 +2244,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1184 msgid "" -"This bit is set when the type object has been fully initialized " -"by :c:func:`PyType_Ready`." +"This bit is set when the type object has been fully initialized by :c:func:" +"`PyType_Ready`." msgstr "" #: ../../c-api/typeobj.rst:1194 @@ -2259,26 +2258,27 @@ msgstr "" msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " -"be allocated using :c:macro:`PyObject_GC_New` " -"or :c:func:`PyType_GenericAlloc` and deallocated " -"(see :c:member:`~PyTypeObject.tp_free`) using :c:func:`PyObject_GC_Del`. " -"More information in section :ref:`supporting-cycle-detection`." +"be allocated using :c:macro:`PyObject_GC_New` or :c:func:" +"`PyType_GenericAlloc` and deallocated (see :c:member:`~PyTypeObject." +"tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:" +"`supporting-cycle-detection`." msgstr "" #: ../../c-api/typeobj.rst:1213 ../../c-api/typeobj.rst:1560 #: ../../c-api/typeobj.rst:1704 -msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +msgid "" +"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." +"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" #: ../../c-api/typeobj.rst:1215 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` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values." +"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` " +"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " +"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" +"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " +"values." msgstr "" #: ../../c-api/typeobj.rst:1225 @@ -2294,44 +2294,47 @@ msgstr "" #: ../../c-api/typeobj.rst:1238 msgid "If this flag is set for ``type(meth)``, then:" -msgstr "" +msgstr "如果此旗標為 ``type(meth)`` 所設定,則:" #: ../../c-api/typeobj.rst:1240 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" +"``meth.__get__(obj, cls)(*args, **kwds)``\\(其中 ``obj`` 並非 None)必須等價於 " +"``meth(obj, *args, **kwds)``。" #: ../../c-api/typeobj.rst:1243 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" +"``meth.__get__(None, cls)(*args, **kwds)`` 必須等價於 ``meth(*args, **kwds)``。" #: ../../c-api/typeobj.rst:1246 msgid "" -"This flag enables an optimization for typical method calls like " -"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " -"``obj.meth``." +"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:1254 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." +"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:1260 msgid "" -"This bit indicates that instances of the class have " -"a :attr:`~object.__dict__` attribute, and that the space for the dictionary " -"is managed by the VM." +"This bit indicates that instances of the class have a :attr:`~object." +"__dict__` attribute, and that the space for the dictionary is managed by the " +"VM." msgstr "" #: ../../c-api/typeobj.rst:1263 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." -msgstr "" +msgstr "如果有設定此旗標,則也應該設定 :c:macro:`Py_TPFLAGS_HAVE_GC`。" #: ../../c-api/typeobj.rst:1265 msgid "" @@ -2353,14 +2356,14 @@ msgstr "" #: ../../c-api/typeobj.rst:1285 msgid "" -"This flag is inherited unless " -"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless the :c:member:`~PyTypeObject." +"tp_weaklistoffset` field is set in a superclass." msgstr "" #: ../../c-api/typeobj.rst:1291 msgid "" -"Only usable with variable-size types, i.e. ones with non-" -"zero :c:member:`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-zero :c:member:" +"`~PyTypeObject.tp_itemsize`." msgstr "" #: ../../c-api/typeobj.rst:1294 @@ -2385,10 +2388,9 @@ 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 " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have " -"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " -"interacts with such types will behave differently depending on what kind of " -"check is used." +"types that inherit from built-ins should have their :c:member:`~PyTypeObject." +"tp_flags` set appropriately, or the code that interacts with such types will " +"behave differently depending on what kind of check is used." msgstr "" #: ../../c-api/typeobj.rst:1332 @@ -2399,9 +2401,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1337 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." +"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:1345 @@ -2418,8 +2419,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1358 msgid "" -"This flag is now removed from a class when the " -"class's :py:meth:`~object.__call__` method is reassigned." +"This flag is now removed from a class when the class's :py:meth:`~object." +"__call__` method is reassigned." msgstr "" #: ../../c-api/typeobj.rst:1361 @@ -2444,9 +2445,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1378 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." +"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:1382 @@ -2457,9 +2457,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1385 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." +"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:1391 @@ -2492,8 +2492,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1421 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_SEQUENCE`." msgstr "" #: ../../c-api/typeobj.rst:1424 ../../c-api/typeobj.rst:1446 @@ -2510,8 +2510,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1443 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_MAPPING`." msgstr "" #: ../../c-api/typeobj.rst:1453 @@ -2535,7 +2535,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1469 msgid "This field is *not* inherited by subtypes." -msgstr "" +msgstr "此欄位不會被子型別繼承。" #: ../../c-api/typeobj.rst:1474 msgid "" @@ -2557,11 +2557,11 @@ msgstr "" #: ../../c-api/typeobj.rst:1482 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of " -"a :c:member:`~PyTypeObject.tp_traverse` function simply " -"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " -"objects that the instance owns. For example, this is function :c:func:`!" -"local_traverse` from the :mod:`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of a :c:" +"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " +"on each of the instance's members that are Python objects that the instance " +"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" +"`!_thread` extension module::" msgstr "" #: ../../c-api/typeobj.rst:1488 @@ -2628,9 +2628,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1517 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::" +"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:1521 @@ -2652,19 +2652,18 @@ msgstr "" #: ../../c-api/typeobj.rst:1535 msgid "" -"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters " -"to :c:func:`!local_traverse` to have these specific names; don't name them " -"just anything." +"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" +"func:`!local_traverse` to have these specific names; don't name them just " +"anything." msgstr "" #: ../../c-api/typeobj.rst:1539 msgid "" "Instances of :ref:`heap-allocated types ` hold a reference to " -"their type. Their traversal function must therefore either " -"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " -"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" -"allocated superclass). If they do not, the type object may not be garbage-" -"collected." +"their type. Their traversal function must therefore either visit :c:func:" +"`Py_TYPE(self) `, or delegate this responsibility by calling " +"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " +"superclass). If they do not, the type object may not be garbage-collected." msgstr "" #: ../../c-api/typeobj.rst:1548 @@ -2682,12 +2681,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1562 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:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"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:" +"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" #: ../../c-api/typeobj.rst:1570 @@ -2711,16 +2708,16 @@ msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " "integers. However, it may be convenient to clear all references, and write " -"the type's :c:member:`~PyTypeObject.tp_dealloc` function to " -"invoke :c:member:`!tp_clear` to avoid code duplication. (Beware " -"that :c:member:`!tp_clear` might have already been called. Prefer calling " -"idempotent functions like :c:func:`Py_CLEAR`.)" +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:" +"`!tp_clear` to avoid code duplication. (Beware that :c:member:`!tp_clear` " +"might have already been called. Prefer calling idempotent functions like :c:" +"func:`Py_CLEAR`.)" msgstr "" #: ../../c-api/typeobj.rst:1587 msgid "" -"Any non-trivial cleanup should be performed " -"in :c:member:`~PyTypeObject.tp_finalize` instead of :c:member:`!tp_clear`." +"Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." +"tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" #: ../../c-api/typeobj.rst:1592 @@ -2750,8 +2747,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1611 msgid "" -"This function differs from the destructor " -"(:c:member:`~PyTypeObject.tp_dealloc`) in the following ways:" +"This function differs from the destructor (:c:member:`~PyTypeObject." +"tp_dealloc`) in the following ways:" msgstr "" #: ../../c-api/typeobj.rst:1614 @@ -2760,18 +2757,18 @@ msgid "" "that might participate in a reference cycle. The purpose of the destructor, " "on the other hand, is a superset: it must release *all* resources it owns, " "including references to objects that cannot participate in a reference cycle " -"(e.g., integers) as well as the object's own memory (by " -"calling :c:member:`~PyTypeObject.tp_free`)." +"(e.g., integers) as well as the object's own memory (by calling :c:member:" +"`~PyTypeObject.tp_free`)." msgstr "" #: ../../c-api/typeobj.rst:1620 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" -"tp_clear` must not deallocate the object's own memory " -"(:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is " -"only called when no (strong) references exist, and as such, must safely " -"destroy the object itself by deallocating it." +"tp_clear` must not deallocate the object's own memory (:c:member:" +"`~PyTypeObject.tp_free`). The destructor, on the other hand, is only called " +"when no (strong) references exist, and as such, must safely destroy the " +"object itself by deallocating it." msgstr "" #: ../../c-api/typeobj.rst:1626 @@ -2812,10 +2809,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1644 msgid "" -"Python will not destroy an object until after any automatic calls to " -"its :c:member:`!tp_clear` function have returned. This ensures that the act " -"of breaking a reference cycle does not invalidate the ``self`` pointer " -"while :c:member:`!tp_clear` is still executing." +"Python will not destroy an object until after any automatic calls to its :c:" +"member:`!tp_clear` function have returned. This ensures that the act of " +"breaking a reference cycle does not invalidate the ``self`` pointer while :c:" +"member:`!tp_clear` is still executing." msgstr "" #: ../../c-api/typeobj.rst:1648 @@ -2836,13 +2833,12 @@ msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " "in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " -"example, the tuple type does not implement " -"a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to " -"prove that no reference cycle can be composed entirely of tuples. Therefore " -"the :c:member:`~PyTypeObject.tp_clear` functions of other types are " -"responsible for breaking any cycle containing a tuple. This isn't " -"immediately obvious, and there's rarely a good reason to avoid " -"implementing :c:member:`~PyTypeObject.tp_clear`." +"example, the tuple type does not implement a :c:member:`~PyTypeObject." +"tp_clear` function, because it's possible to prove that no reference cycle " +"can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." +"tp_clear` functions of other types are responsible for breaking any cycle " +"containing a tuple. This isn't immediately obvious, and there's rarely a " +"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" #: ../../c-api/typeobj.rst:1666 @@ -2880,9 +2876,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1681 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 :c:func:`Py_DECREF`) until after the pointer to the contained object is " -"set to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released (via :" +"c:func:`Py_DECREF`) until after the pointer to the contained object is set " +"to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2894,9 +2890,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1693 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::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" msgstr "" #: ../../c-api/typeobj.rst:1697 @@ -2905,12 +2901,10 @@ msgstr "PyObject_ClearManagedDict((PyObject*)self);" #: ../../c-api/typeobj.rst:1706 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, :c:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"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, :" +"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" #: ../../c-api/typeobj.rst:1718 @@ -2938,9 +2932,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1730 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`:" +"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:1736 @@ -2998,21 +2991,19 @@ msgstr "" #: ../../c-api/typeobj.rst:1771 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_hash`: a subtype " -"inherits :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" +"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1778 msgid "" -":c:data:`PyBaseObject_Type` provides " -"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " -"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " -"not even the inherited function is used and instances of the type will not " -"be able to participate in any comparisons." +":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." +"tp_richcompare` implementation, which may be inherited. However, if only :c:" +"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " +"is used and instances of the type will not be able to participate in any " +"comparisons." msgstr "" #: ../../c-api/typeobj.rst:1787 @@ -3027,8 +3018,8 @@ msgid "" "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of " -"type :c:expr:`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of type :c:expr:" +"`PyObject*` which is initialized to ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1797 @@ -3054,18 +3045,17 @@ msgstr "" #: ../../c-api/typeobj.rst:1812 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, " -"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " -"value, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." +"tp_weaklistoffset` will be set to a negative value, to indicate that it is " +"unsafe to use this field." msgstr "" #: ../../c-api/typeobj.rst:1820 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)." +"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:1824 @@ -3078,8 +3068,8 @@ msgstr "PyObject *tp_iter(PyObject *self);" #: ../../c-api/typeobj.rst:1835 msgid "" -"An optional pointer to a function that returns the next item in " -"an :term:`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in an :term:" +"`iterator`. The signature is::" msgstr "" #: ../../c-api/typeobj.rst:1838 @@ -3088,10 +3078,10 @@ msgstr "PyObject *tp_iternext(PyObject *self);" #: ../../c-api/typeobj.rst:1840 msgid "" -"When the iterator is exhausted, it must return ``NULL``; " -"a :exc:`StopIteration` exception may or may not be set. When another error " -"occurs, it must return ``NULL`` too. Its presence signals that the " -"instances of this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; a :exc:" +"`StopIteration` exception may or may not be set. When another error occurs, " +"it must return ``NULL`` too. Its presence signals that the instances of " +"this type are iterators." msgstr "" #: ../../c-api/typeobj.rst:1845 @@ -3107,8 +3097,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1858 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." +"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:1861 @@ -3125,9 +3115,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1872 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." +"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:1876 @@ -3144,9 +3134,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1887 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " -"instances of this type." +"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:1890 @@ -3179,10 +3169,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1914 msgid "" -"However, the unary '&' operator applied to a non-static variable " -"like :c:data:`PyBaseObject_Type` is not required to produce an address " -"constant. Compilers may support this (gcc does), MSVC does not. Both " -"compilers are strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable like :c:" +"data:`PyBaseObject_Type` is not required to produce an address constant. " +"Compilers may support this (gcc does), MSVC does not. Both compilers are " +"strictly standard conforming in this particular behavior." msgstr "" #: ../../c-api/typeobj.rst:1920 @@ -3211,23 +3201,22 @@ msgid "" "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations " -"(like :meth:`~object.__add__`). Once initialization for the type has " -"finished, this field should be treated as read-only." +"they don't correspond to overloaded operations (like :meth:`~object." +"__add__`). Once initialization for the type has finished, this field should " +"be treated as read-only." msgstr "" #: ../../c-api/typeobj.rst:1945 msgid "" -"Some types may not store their dictionary in this slot. " -"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " -"type." +"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:1951 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." +"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:1957 @@ -3244,8 +3233,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1967 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." +"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:1973 @@ -3287,8 +3276,8 @@ msgstr "" 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 " -"of the type of the instance variable dictionary; this offset is used " -"by :c:func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used by :c:" +"func:`PyObject_GenericGetAttr`." msgstr "" #: ../../c-api/typeobj.rst:2014 @@ -3306,25 +3295,24 @@ msgstr "" #: ../../c-api/typeobj.rst:2019 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary " -"call :c:func:`PyObject_GenericGetDict`. " -"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " -"the dictionary, so it is may be more efficient to " -"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary call :c:func:" +"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " +"need to allocate memory for the dictionary, so it is may be more efficient " +"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" #: ../../c-api/typeobj.rst:2025 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` 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:2030 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 " -"at the previous offset. To properly support inheritance, " -"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, use :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT`." msgstr "" #: ../../c-api/typeobj.rst:2037 @@ -3336,10 +3324,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2040 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." +"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:2048 @@ -3361,20 +3348,20 @@ msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" #: ../../c-api/typeobj.rst:2059 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__`." +"arguments represent positional and keyword arguments of the call to :meth:" +"`~object.__init__`." msgstr "" #: ../../c-api/typeobj.rst:2063 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 :c:member:`~PyTypeObject.tp_new` function has returned an instance of " -"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " -"instance of some other type that is not a subtype of the original type, " -"no :c:member:`~PyTypeObject.tp_init` function is called; " -"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " -"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the type's :" +"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " +"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " +"of some other type that is not a subtype of the original type, no :c:member:" +"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." +"tp_new` returns an instance of a subtype of the original type, the " +"subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" #: ../../c-api/typeobj.rst:2070 @@ -3396,8 +3383,8 @@ msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" #: ../../c-api/typeobj.rst:2091 msgid "" -"Static subtypes inherit this slot, which will " -"be :c:func:`PyType_GenericAlloc` if inherited from :class:`object`." +"Static subtypes inherit this slot, which will be :c:func:" +"`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" #: ../../c-api/typeobj.rst:2094 ../../c-api/typeobj.rst:2161 @@ -3427,9 +3414,9 @@ msgstr "" 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 " -"to the type. Note that *subtype* doesn't have to equal the type " -"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " -"subtype of that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type whose :c:" +"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " +"that type (but not an unrelated type)." msgstr "" #: ../../c-api/typeobj.rst:2118 @@ -3439,9 +3426,9 @@ msgid "" "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place " -"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " -"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place in :c:member:" +"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " +"be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" #: ../../c-api/typeobj.rst:2126 @@ -3452,10 +3439,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2131 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``." +"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:2137 @@ -3477,25 +3463,24 @@ msgstr "void tp_free(void *self);" #: ../../c-api/typeobj.rst:2149 msgid "" -"This function must free the memory allocated " -"by :c:member:`~PyTypeObject.tp_alloc`." +"This function must free the memory allocated by :c:member:`~PyTypeObject." +"tp_alloc`." msgstr "" #: ../../c-api/typeobj.rst:2154 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " -"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " -"in :c:member:`~PyTypeObject.tp_flags`) and it would " -"inherit :c:func:`PyObject_Free`, then this slot is not inherited but instead " -"defaults to :c:func:`PyObject_GC_Del`." +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:" +"`~PyTypeObject.tp_flags`) and it would inherit :c:func:`PyObject_Free`, then " +"this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" #: ../../c-api/typeobj.rst:2165 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " -"suitable to match :c:func:`PyType_GenericAlloc` and the value of " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/typeobj.rst:2174 @@ -3506,12 +3491,12 @@ msgstr "" 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 " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " -"of statically and dynamically allocated instances, and the statically " -"allocated instances are not collectible. Such types should define this " -"function; it should return ``1`` for a collectible instance, and ``0`` for a " -"non-collectible instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " +"and dynamically allocated instances, and the statically allocated instances " +"are not collectible. Such types should define this function; it should " +"return ``1`` for a collectible instance, and ``0`` for a non-collectible " +"instance. The signature is::" msgstr "" #: ../../c-api/typeobj.rst:2184 @@ -3520,15 +3505,15 @@ msgstr "int tp_is_gc(PyObject *self);" #: ../../c-api/typeobj.rst:2186 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 `.)" +"(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:2196 msgid "" -"This slot has no default. If this field is " -"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"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:2202 @@ -3544,8 +3529,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2207 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." +"` can be used instead of the *bases* argument of :c:func:" +"`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" #: ../../c-api/typeobj.rst:2214 @@ -3569,8 +3554,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2233 msgid "" -"This field is not inherited; it is calculated fresh " -"by :c:func:`PyType_Ready`." +"This field is not inherited; it is calculated fresh by :c:func:" +"`PyType_Ready`." msgstr "" #: ../../c-api/typeobj.rst:2239 @@ -3584,8 +3569,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2250 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__`." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__`." msgstr "" #: ../../c-api/typeobj.rst:2255 @@ -3611,7 +3596,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2282 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." -msgstr "" +msgstr "此欄位已被棄用。請改用 :c:member:`~PyTypeObject.tp_finalize`。" #: ../../c-api/typeobj.rst:2287 msgid "Used to index into the method cache. Internal use only." @@ -3640,8 +3625,8 @@ msgstr "" msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " -"However, none of the referents will have been automatically cleared " -"(:c:member:`~PyTypeObject.tp_clear`) yet." +"However, none of the referents will have been automatically cleared (:c:" +"member:`~PyTypeObject.tp_clear`) yet." msgstr "" #: ../../c-api/typeobj.rst:2313 @@ -3678,8 +3663,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2340 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " -"some global variables have been deleted. See the documentation of " -"the :meth:`~object.__del__` method for details." +"some global variables have been deleted. See the documentation of the :meth:" +"`~object.__del__` method for details." msgstr "" #: ../../c-api/typeobj.rst:2344 @@ -3690,10 +3675,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2346 msgid "" "Python might mark the object as *finalized*. Currently, Python always marks " -"objects whose type supports garbage collection (i.e., " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " -"in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of " -"objects; this might change in a future version." +"objects whose type supports garbage collection (i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and " +"never marks other types of objects; this might change in a future version." msgstr "" #: ../../c-api/typeobj.rst:2351 @@ -3723,9 +3707,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2366 msgid "" "*Automatic finalization* refers to any finalization performed by Python " -"except via calls to :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc`. No guarantees are made " -"about when, if, or how often an object is automatically finalized, except:" +"except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`. No guarantees are made about when, if, " +"or how often an object is automatically finalized, except:" msgstr "" #: ../../c-api/typeobj.rst:2371 @@ -3739,10 +3723,10 @@ msgstr "" msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " -"type does not support garbage collection, i.e., " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still " -"be manually finalized by calling :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc`." +"type does not support garbage collection, i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still be manually " +"finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`." msgstr "" #: ../../c-api/typeobj.rst:2380 @@ -3760,8 +3744,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2384 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " -"automatically finalize it after automatically clearing " -"(see :c:member:`~PyTypeObject.tp_clear`) any other member." +"automatically finalize it after automatically clearing (see :c:member:" +"`~PyTypeObject.tp_clear`) any other member." msgstr "" #: ../../c-api/typeobj.rst:2387 @@ -3773,35 +3757,33 @@ msgstr "" #: ../../c-api/typeobj.rst:2390 msgid "" -"If Python is going to automatically clear an object " -"(:c:member:`~PyTypeObject.tp_clear`), it will automatically finalize the " -"object first." +"If Python is going to automatically clear an object (:c:member:" +"`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" #: ../../c-api/typeobj.rst:2394 msgid "" -"Python currently only automatically finalizes objects that are members of " -"a :term:`cyclic isolate`, but future versions might finalize objects " -"regularly before their destruction." +"Python currently only automatically finalizes objects that are members of a :" +"term:`cyclic isolate`, but future versions might finalize objects regularly " +"before their destruction." msgstr "" #: ../../c-api/typeobj.rst:2398 msgid "" -"To manually finalize an object, do not call this function directly; " -"call :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc` instead." +"To manually finalize an object, do not call this function directly; call :c:" +"func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " +"instead." msgstr "" #: ../../c-api/typeobj.rst:2402 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " -"to back up the exception at the beginning by " -"calling :c:func:`PyErr_GetRaisedException` and restore the exception at the " -"end by calling :c:func:`PyErr_SetRaisedException`. If an exception is " -"encountered in the middle of the finalizer, log and clear it " -"with :c:func:`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. " -"For example::" +"to back up the exception at the beginning by calling :c:func:" +"`PyErr_GetRaisedException` and restore the exception at the end by calling :" +"c:func:`PyErr_SetRaisedException`. If an exception is encountered in the " +"middle of the finalizer, log and clear it with :c:func:" +"`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" #: ../../c-api/typeobj.rst:2411 @@ -3829,9 +3811,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2439 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." +"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:2445 @@ -3876,7 +3858,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2473 msgid "calls ``type->tp_new``," -msgstr "" +msgstr "呼叫 ``type->tp_new``," #: ../../c-api/typeobj.rst:2475 msgid "" @@ -3886,15 +3868,15 @@ msgstr "" #: ../../c-api/typeobj.rst:2478 msgid "returns the result of ``tp_new``." -msgstr "" +msgstr "回傳 ``tp_new`` 的結果。" #: ../../c-api/typeobj.rst:2480 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " -"specific :c:member:`~PyTypeObject.tp_new` " -"and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable " -"types, note that both can be overridden (using :py:func:`~object.__new__` " -"and :py:func:`~object.__init__`, respectively)." +"specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." +"tp_init`. When doing this for user-subclassable types, note that both can be " +"overridden (using :py:func:`~object.__new__` and :py:func:`~object." +"__init__`, respectively)." msgstr "" #: ../../c-api/typeobj.rst:2491 @@ -3911,13 +3893,13 @@ msgstr "" #: ../../c-api/typeobj.rst:2506 msgid "Static Types" -msgstr "" +msgstr "靜態型別" #: ../../c-api/typeobj.rst:2508 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`." +"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:2512 @@ -3953,21 +3935,21 @@ msgstr "" #: ../../c-api/typeobj.rst:2530 msgid "Heap Types" -msgstr "" +msgstr "堆積型別" #: ../../c-api/typeobj.rst:2532 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have " -"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have the :c:macro:" +"`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" #: ../../c-api/typeobj.rst:2537 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`." +"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:2545 @@ -4092,7 +4074,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2659 msgid "Mapping Object Structures" -msgstr "" +msgstr "對映物件結構" #: ../../c-api/typeobj.rst:2666 msgid "" @@ -4102,25 +4084,24 @@ msgstr "" #: ../../c-api/typeobj.rst:2671 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." +"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:2677 msgid "" -"This function is used by :c:func:`PyObject_GetItem` " -"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for " -"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " -"otherwise." +"This function is used by :c:func:`PyObject_GetItem` and :c:func:" +"`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for the :c:func:" +"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" #: ../../c-api/typeobj.rst:2685 msgid "" -"This function is used " -"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " -"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used by :c:func:`PyObject_SetItem`, :c:func:" +"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" +"`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." @@ -4128,7 +4109,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2696 msgid "Sequence Object Structures" -msgstr "" +msgstr "序列物件結構" #: ../../c-api/typeobj.rst:2703 msgid "" @@ -4138,10 +4119,10 @@ msgstr "" #: ../../c-api/typeobj.rst:2708 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 negative indices via the :c:member:`~PySequenceMethods.sq_item` " -"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." +"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 " +"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" +"member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" #: ../../c-api/typeobj.rst:2715 @@ -4169,21 +4150,20 @@ msgstr "" #: ../../c-api/typeobj.rst:2733 msgid "" -"Negative indexes are handled as follows: if " -"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " -"and the sequence length is used to compute a positive index which is passed " -"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " -"``NULL``, the index is passed as is to the function." +"Negative indexes are handled as follows: if the :c:member:" +"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " +"length is used to compute a positive index which is passed to :c:member:" +"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " +"index is passed as is to the function." msgstr "" #: ../../c-api/typeobj.rst:2740 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:`PyObject_DelItem`, after trying the item assignment and " -"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " -"slot may be left to ``NULL`` if the object does not support item assignment " -"and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" +"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" +"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " +"``NULL`` if the object does not support item assignment and deletion." msgstr "" #: ../../c-api/typeobj.rst:2749 @@ -4199,8 +4179,8 @@ msgid "" "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via " -"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via the :" +"c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" #: ../../c-api/typeobj.rst:2765 @@ -4215,7 +4195,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2776 msgid "Buffer Object Structures" -msgstr "" +msgstr "緩衝區物件結構" #: ../../c-api/typeobj.rst:2784 msgid "" @@ -4228,7 +4208,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2893 ../../c-api/typeobj.rst:2904 #: ../../c-api/typeobj.rst:2916 ../../c-api/typeobj.rst:2926 msgid "The signature of this function is::" -msgstr "" +msgstr "函式的簽名為: ::" #: ../../c-api/typeobj.rst:2792 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" @@ -4243,8 +4223,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2798 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, " -"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." +"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:2801 @@ -4272,8 +4252,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2812 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." +"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:2815 @@ -4293,9 +4273,10 @@ msgstr "" #: ../../c-api/typeobj.rst:2824 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:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " -"and :c:member:`~Py_buffer.internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers left. :c:member:" +"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." +"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." +"internal` are read-only for the consumer." msgstr "" #: ../../c-api/typeobj.rst:2831 @@ -4353,12 +4334,12 @@ msgstr "" #: ../../c-api/typeobj.rst:2871 msgid "Async Object Structures" -msgstr "" +msgstr "非同步物件結構" #: ../../c-api/typeobj.rst:2879 msgid "" -"This structure holds pointers to the functions required to " -"implement :term:`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to implement :term:" +"`awaitable` and :term:`asynchronous iterator` objects." msgstr "" #: ../../c-api/typeobj.rst:2884 @@ -4398,8 +4379,8 @@ msgstr "PyObject *am_aiter(PyObject *self);" #: ../../c-api/typeobj.rst:2908 msgid "" -"Must return an :term:`asynchronous iterator` object. " -"See :meth:`~object.__anext__` for details." +"Must return an :term:`asynchronous iterator` object. See :meth:`~object." +"__anext__` for details." msgstr "" #: ../../c-api/typeobj.rst:2911 @@ -4437,21 +4418,20 @@ 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 " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " -"and :c:member:`~PyObject.ob_type` set to the type argument. If the " -"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " -"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " -"*nitems* and the length of the allocated memory block should be " -"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " -"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " -"block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." +"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." +"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " +"field should be initialized to *nitems* and the length of the allocated " +"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " +"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " +"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" #: ../../c-api/typeobj.rst:2953 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`." +"allocate additional memory; that should be done by :c:member:`~PyTypeObject." +"tp_new`." msgstr "" #: ../../c-api/typeobj.rst:2960 @@ -4687,8 +4667,8 @@ msgstr "" #: ../../c-api/typeobj.rst:3141 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::" +"instances (e.g. uses a separate factory func) using :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" #: ../../c-api/typeobj.rst:3145 diff --git a/c-api/unicode.po b/c-api/unicode.po index 6a742dde0b..031c9279e7 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 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-" @@ -114,8 +114,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:107 @@ -162,15 +162,15 @@ msgstr "" #: ../../c-api/unicode.rst:152 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:160 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:169 @@ -194,8 +194,8 @@ msgstr "" #: ../../c-api/unicode.rst:188 msgid "" -"Return true if the string only contains ASCII characters. Equivalent " -"to :py:meth:`str.isascii`." +"Return true if the string only contains ASCII characters. Equivalent to :py:" +"meth:`str.isascii`." msgstr "" #: ../../c-api/unicode.rst:195 @@ -353,11 +353,11 @@ msgstr "" #: ../../c-api/unicode.rst:330 msgid "" -"After creation, the string can be filled " -"by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` " -"or similar. Since strings are supposed to be immutable, take care to not " -"“use” the result while it is being modified. In particular, before it's " -"filled with its final contents, a string:" +"After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :" +"c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:" +"`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, " +"take care to not “use” the result while it is being modified. In particular, " +"before it's filled with its final contents, a string:" msgstr "" #: ../../c-api/unicode.rst:337 @@ -393,19 +393,18 @@ msgstr "" #: ../../c-api/unicode.rst:357 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:362 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:373 @@ -466,9 +465,9 @@ msgstr "" #: ../../c-api/unicode.rst:410 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:415 @@ -750,8 +749,8 @@ msgstr "``T``" #: ../../c-api/unicode.rst:533 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:536 @@ -774,8 +773,8 @@ msgstr ":c:expr:`PyTypeObject*`" #: ../../c-api/unicode.rst:543 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:546 @@ -895,8 +894,8 @@ msgstr "" #: ../../c-api/unicode.rst:633 msgid "" -"Append the string *right* to the end of *p_left*. *p_left* must point to " -"a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"Append the string *right* to the end of *p_left*. *p_left* must point to a :" +"term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " "releases (\"steals\") this reference." msgstr "" @@ -925,8 +924,8 @@ msgstr "" #: ../../c-api/unicode.rst:661 msgid "" -"Return the name of the default string encoding, ``\"utf-8\"``. " -"See :func:`sys.getdefaultencoding`." +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." msgstr "" #: ../../c-api/unicode.rst:664 @@ -984,8 +983,8 @@ msgstr "" #: ../../c-api/unicode.rst:712 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:715 @@ -1009,16 +1008,16 @@ msgstr "" #: ../../c-api/unicode.rst:733 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " -"not out of bounds, and that the object's reference count is one). " -"See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making " -"them your responsibility." +"not out of bounds, and that the object's reference count is one. See :c:func:" +"`PyUnicode_WRITE` for a version that skips these checks, making them your " +"responsibility." msgstr "" #: ../../c-api/unicode.rst:746 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:750 @@ -1042,10 +1041,10 @@ msgstr "" #: ../../c-api/unicode.rst:778 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:787 @@ -1069,8 +1068,8 @@ msgstr "" #: ../../c-api/unicode.rst:803 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:806 ../../c-api/unicode.rst:841 @@ -1084,9 +1083,9 @@ msgstr ":c:func:`Py_DecodeLocale` 函式。" #: ../../c-api/unicode.rst:814 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:823 @@ -1102,14 +1101,14 @@ 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:838 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:845 ../../c-api/unicode.rst:957 @@ -1119,9 +1118,9 @@ msgstr ":c:func:`Py_EncodeLocale` 函式。" #: ../../c-api/unicode.rst:849 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:858 @@ -1144,8 +1143,8 @@ msgstr "" #: ../../c-api/unicode.rst:869 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 " @@ -1175,15 +1174,14 @@ msgstr "" 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:908 @@ -1198,8 +1196,8 @@ msgstr "" #: ../../c-api/unicode.rst:921 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:928 ../../c-api/unicode.rst:941 @@ -1217,8 +1215,8 @@ msgstr "" #: ../../c-api/unicode.rst:938 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:948 @@ -1230,8 +1228,8 @@ msgstr "" #: ../../c-api/unicode.rst:952 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:966 @@ -1254,8 +1252,8 @@ msgstr "" 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:985 @@ -1267,9 +1265,9 @@ msgstr "" #: ../../c-api/unicode.rst:988 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 "" @@ -1281,9 +1279,8 @@ msgid "" "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:1006 @@ -1456,8 +1453,8 @@ msgid "" "`_ 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:1159 @@ -1807,8 +1804,8 @@ msgstr "" #: ../../c-api/unicode.rst:1457 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:1467 @@ -1950,8 +1947,8 @@ msgstr "" #: ../../c-api/unicode.rst:1596 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:1601 @@ -1972,8 +1969,8 @@ msgstr "如果 *a* 不等於 *b*,則回傳 ``0``。" #: ../../c-api/unicode.rst:1610 msgid "" -"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not " -"a :class:`str` object." +"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :" +"class:`str` object." msgstr "" #: ../../c-api/unicode.rst:1613 @@ -2036,9 +2033,8 @@ msgstr "" #: ../../c-api/unicode.rst:1666 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:1672 @@ -2063,11 +2059,11 @@ msgstr "" 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:1694 @@ -2086,9 +2082,9 @@ msgstr "" #: ../../c-api/unicode.rst:1702 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:1706 @@ -2099,9 +2095,8 @@ msgstr "" #: ../../c-api/unicode.rst:1712 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:1715 @@ -2116,8 +2111,8 @@ 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:1728 @@ -2141,8 +2136,8 @@ msgstr "PyUnicodeWriter" #: ../../c-api/unicode.rst:1743 msgid "" -"The :c:type:`PyUnicodeWriter` API can be used to create a " -"Python :class:`str` object." +"The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:" +"`str` object." msgstr "" #: ../../c-api/unicode.rst:1750 @@ -2274,8 +2269,7 @@ msgstr "" msgid "" "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " "into *writer*." -msgstr "" -"類似於 :c:func:`PyUnicode_FromFormat`,但是直接將輸出寫入 *writer*。" +msgstr "類似於 :c:func:`PyUnicode_FromFormat`,但是直接將輸出寫入 *writer*。" #: ../../c-api/unicode.rst:1869 msgid "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 2deb1dabda..3149d8034c 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-03 00:19+0000\n" +"POT-Creation-Date: 2025-10-08 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-" @@ -216,34 +216,35 @@ msgid "" "objects *globals* and *locals* with the compiler flags specified by " "*flags*. *globals* must be a dictionary; *locals* can be any object that " "implements the mapping protocol. The parameter *start* specifies the start " -"token that should be used to parse the source code." +"symbol and must one of the following: :c:data:`Py_eval_input`, :c:data:" +"`Py_file_input`, or :c:data:`Py_single_input`." msgstr "" -#: ../../c-api/veryhigh.rst:188 +#: ../../c-api/veryhigh.rst:189 msgid "" "Returns the result of executing the code as a Python object, or ``NULL`` if " "an exception was raised." msgstr "" -#: ../../c-api/veryhigh.rst:194 +#: ../../c-api/veryhigh.rst:195 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:200 +#: ../../c-api/veryhigh.rst:201 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:206 +#: ../../c-api/veryhigh.rst:207 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0``." msgstr "" -#: ../../c-api/veryhigh.rst:212 +#: ../../c-api/veryhigh.rst:213 msgid "" "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " "from *fp* instead of an in-memory string. *filename* should be the name of " @@ -252,22 +253,22 @@ msgid "" "`PyRun_FileExFlags` returns." msgstr "" -#: ../../c-api/veryhigh.rst:221 +#: ../../c-api/veryhigh.rst:222 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:227 +#: ../../c-api/veryhigh.rst:228 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, " "with *optimize* set to ``-1``." msgstr "" -#: ../../c-api/veryhigh.rst:233 +#: ../../c-api/veryhigh.rst:234 msgid "" "Parse and compile the Python source code in *str*, returning the resulting " -"code object. The start token is given by *start*; this can be used to " +"code object. The start symbol is given by *start*; this can be used to " "constrain the code which can be compiled and should be :c:data:" "`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`. The " "filename specified by *filename* is used to construct the code object and " @@ -275,7 +276,7 @@ msgid "" "returns ``NULL`` if the code cannot be parsed or compiled." msgstr "" -#: ../../c-api/veryhigh.rst:241 +#: ../../c-api/veryhigh.rst:242 msgid "" "The integer *optimize* specifies the optimization level of the compiler; a " "value of ``-1`` selects the optimization level of the interpreter as given " @@ -284,20 +285,20 @@ msgid "" "or ``2`` (docstrings are removed too)." msgstr "" -#: ../../c-api/veryhigh.rst:252 +#: ../../c-api/veryhigh.rst:253 msgid "" "Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/veryhigh.rst:259 +#: ../../c-api/veryhigh.rst:260 msgid "" "This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the " "code object, and global and local variables. The other arguments are set to " "``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:266 +#: ../../c-api/veryhigh.rst:267 msgid "" "Evaluate a precompiled code object, given a particular environment for its " "evaluation. This environment consists of a dictionary of global variables, " @@ -306,13 +307,13 @@ msgid "" "only_parameter>` arguments and a closure tuple of cells." msgstr "" -#: ../../c-api/veryhigh.rst:275 +#: ../../c-api/veryhigh.rst:276 msgid "" "Evaluate an execution frame. This is a simplified interface to :c:func:" "`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -#: ../../c-api/veryhigh.rst:281 +#: ../../c-api/veryhigh.rst:282 msgid "" "This is the main, unvarnished function of Python interpretation. The code " "object associated with the execution frame *f* is executed, interpreting " @@ -322,39 +323,39 @@ msgid "" "of generator objects." msgstr "" -#: ../../c-api/veryhigh.rst:288 +#: ../../c-api/veryhigh.rst:289 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/veryhigh.rst:295 +#: ../../c-api/veryhigh.rst:296 msgid "" "This function changes the flags of the current evaluation frame, and returns " "true on success, false on failure." msgstr "" -#: ../../c-api/veryhigh.rst:303 +#: ../../c-api/veryhigh.rst:304 msgid "" "The start symbol from the Python grammar for isolated expressions; for use " "with :c:func:`Py_CompileString`." msgstr "" -#: ../../c-api/veryhigh.rst:311 +#: ../../c-api/veryhigh.rst:312 msgid "" "The start symbol from the Python grammar for sequences of statements as read " "from a file or other source; for use with :c:func:`Py_CompileString`. This " "is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -#: ../../c-api/veryhigh.rst:320 +#: ../../c-api/veryhigh.rst:321 msgid "" "The start symbol from the Python grammar for a single statement; for use " "with :c:func:`Py_CompileString`. This is the symbol used for the interactive " "interpreter loop." msgstr "" -#: ../../c-api/veryhigh.rst:327 +#: ../../c-api/veryhigh.rst:328 msgid "" "This is the structure used to hold compiler flags. In cases where code is " "only being compiled, it is passed as ``int flags``, and in cases where code " @@ -362,44 +363,44 @@ msgid "" "case, ``from __future__ import`` can modify *flags*." msgstr "" -#: ../../c-api/veryhigh.rst:332 +#: ../../c-api/veryhigh.rst:333 msgid "" "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." "cf_flags` is treated as equal to ``0``, and any modification due to ``from " "__future__ import`` is discarded." msgstr "" -#: ../../c-api/veryhigh.rst:338 +#: ../../c-api/veryhigh.rst:339 msgid "Compiler flags." msgstr "" -#: ../../c-api/veryhigh.rst:342 +#: ../../c-api/veryhigh.rst:343 msgid "" "*cf_feature_version* is the minor Python version. It should be initialized " "to ``PY_MINOR_VERSION``." msgstr "" -#: ../../c-api/veryhigh.rst:345 +#: ../../c-api/veryhigh.rst:346 msgid "" "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " "flag is set in :c:member:`~PyCompilerFlags.cf_flags`." msgstr "" -#: ../../c-api/veryhigh.rst:348 +#: ../../c-api/veryhigh.rst:349 msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:351 +#: ../../c-api/veryhigh.rst:352 msgid "The available compiler flags are accessible as macros:" msgstr "" -#: ../../c-api/veryhigh.rst:360 +#: ../../c-api/veryhigh.rst:361 msgid "" "See :ref:`compiler flags ` in documentation of the :py:" "mod:`!ast` Python module, which exports these constants under the same names." msgstr "" -#: ../../c-api/veryhigh.rst:364 +#: ../../c-api/veryhigh.rst:365 msgid "" "The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags " "such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally " @@ -407,7 +408,7 @@ msgid "" "`c_codeobject_flags` for a complete list." msgstr "" -#: ../../c-api/veryhigh.rst:301 ../../c-api/veryhigh.rst:309 -#: ../../c-api/veryhigh.rst:318 +#: ../../c-api/veryhigh.rst:302 ../../c-api/veryhigh.rst:310 +#: ../../c-api/veryhigh.rst:319 msgid "Py_CompileString (C function)" msgstr "Py_CompileString(C 函式)" diff --git a/deprecations/index.po b/deprecations/index.po index 06b7a16536..f670deffde 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-06 00:15+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-" @@ -86,7 +86,7 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" @@ -181,7 +181,7 @@ msgstr "" "`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 -#: ../../deprecations/pending-removal-in-3.17.rst:4 +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -476,8 +476,55 @@ msgstr "" msgid "Pending removal in Python 3.17" msgstr "Python 3.17 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr ":class:`collections.abc.ByteString` 預計在 Python 3.17 中移除。" + +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"更多細節請見 :pep:`PEP 688 <688#current-options>`。(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:28 +msgid "" "Before Python 3.14, old-style unions were implemented using the private " "class ``typing._UnionGenericAlias``. This class is no longer needed for the " "implementation, but it has been retained for backward compatibility, with " @@ -490,35 +537,12 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" -#: ../../deprecations/pending-removal-in-3.17.rst:11 +#: ../../deprecations/pending-removal-in-3.17.rst:33 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " -"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " -"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " -"Shantanu Jain in :gh:`91896`.)" -msgstr "" -"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " -"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" -"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " -"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.17.rst:17 -msgid ":mod:`collections.abc`:" -msgstr ":mod:`collections.abc`:" - -#: ../../deprecations/pending-removal-in-3.17.rst:19 -msgid "" -":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " -"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." -"Buffer`. For use in type annotations, prefer a union, like ``bytes | " -"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " -"Jain in :gh:`91896`.)" +"removal in Python 3.17." msgstr "" -":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " -":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" -"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." -"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" +":class:`typing.ByteString` 自 Python 3.9 起已被棄用,預計在 Python 3.17 中移除。" #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" @@ -566,10 +590,6 @@ msgid "The :class:`argparse.FileType` type converter is deprecated." msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 -msgid "``bool(NotImplemented)``." -msgstr "``bool(NotImplemented)``。" - -#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -578,7 +598,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:22 +#: ../../deprecations/pending-removal-in-future.rst:21 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -590,13 +610,13 @@ msgid "" "syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " -"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"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`)" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:29 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -605,7 +625,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:32 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -614,7 +634,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:35 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -623,11 +643,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:38 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:40 +#: ../../deprecations/pending-removal-in-future.rst:39 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 " @@ -637,7 +657,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:45 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -647,25 +667,25 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" "`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" -#: ../../deprecations/pending-removal-in-future.rst:52 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:55 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:57 +#: ../../deprecations/pending-removal-in-future.rst:56 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -673,7 +693,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:59 +#: ../../deprecations/pending-removal-in-future.rst:58 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -681,11 +701,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:62 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -693,19 +713,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:71 +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:73 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -713,19 +733,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 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:80 +#: ../../deprecations/pending-removal-in-future.rst:79 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:82 +#: ../../deprecations/pending-removal-in-future.rst:81 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -733,7 +753,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:85 +#: ../../deprecations/pending-removal-in-future.rst:84 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 " @@ -745,12 +765,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 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:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -758,15 +778,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -774,51 +794,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:113 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -826,11 +846,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:116 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:118 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -838,7 +858,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -846,20 +866,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "" "The internal class ``typing._UnionGenericAlias`` is no longer used to " "implement :class:`typing.Union`. To preserve compatibility with users using " @@ -870,7 +890,7 @@ msgstr "" "了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " "shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -878,64 +898,64 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:134 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:137 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:141 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:144 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:145 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:147 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:152 +#: ../../deprecations/pending-removal-in-future.rst:151 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 " @@ -946,7 +966,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:157 +#: ../../deprecations/pending-removal-in-future.rst:156 msgid "" ":func:`sys._clear_type_cache` is deprecated: use :func:`sys." "_clear_internal_caches` instead." @@ -1469,8 +1489,8 @@ msgid "" "(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" "可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " -"Victor Stinner 在 :gh:`128863` 貢獻)" +"compat/>`__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 Victor " +"Stinner 在 :gh:`128863` 貢獻)" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po index 49abbd6744..3357e9e6ed 100644 --- a/deprecations/pending-removal-in-3.17.po +++ b/deprecations/pending-removal-in-3.17.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-09-19 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,10 +21,57 @@ msgid "Pending removal in Python 3.17" msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr ":class:`collections.abc.ByteString` 預計在 Python 3.17 中移除。" + +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"更多細節請見 :pep:`PEP 688 <688#current-options>`。(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.17.rst:6 +#: ../../deprecations/pending-removal-in-3.17.rst:28 msgid "" "Before Python 3.14, old-style unions were implemented using the private " "class ``typing._UnionGenericAlias``. This class is no longer needed for the " @@ -38,32 +85,9 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" -#: ../../deprecations/pending-removal-in-3.17.rst:11 +#: ../../deprecations/pending-removal-in-3.17.rst:33 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " -"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " -"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " -"Shantanu Jain in :gh:`91896`.)" -msgstr "" -"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " -"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" -"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " -"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.17.rst:17 -msgid ":mod:`collections.abc`:" -msgstr ":mod:`collections.abc`:" - -#: ../../deprecations/pending-removal-in-3.17.rst:19 -msgid "" -":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " -"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." -"Buffer`. For use in type annotations, prefer a union, like ``bytes | " -"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " -"Jain in :gh:`91896`.)" +"removal in Python 3.17." msgstr "" -":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " -":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" -"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." -"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" +":class:`typing.ByteString` 自 Python 3.9 起已被棄用,預計在 Python 3.17 中移除。" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 60bdaf627e..6b666a7e95 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.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-06 00:15+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-" @@ -37,11 +37,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -52,10 +52,6 @@ msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" #: ../../deprecations/pending-removal-in-future.rst:18 -msgid "``bool(NotImplemented)``." -msgstr "``bool(NotImplemented)``。" - -#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -64,25 +60,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:22 +#: ../../deprecations/pending-removal-in-future.rst:21 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "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`)" +"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`)" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:29 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -91,92 +87,91 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:32 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:36 +#: ../../deprecations/pending-removal-in-future.rst:35 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` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:38 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:40 +#: ../../deprecations/pending-removal-in-future.rst:39 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` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:45 +#: ../../deprecations/pending-removal-in-future.rst:44 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` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" -#: ../../deprecations/pending-removal-in-future.rst:52 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:55 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:57 +#: ../../deprecations/pending-removal-in-future.rst:56 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:59 +#: ../../deprecations/pending-removal-in-future.rst:58 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:62 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -184,39 +179,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:71 +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:73 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:77 +#: ../../deprecations/pending-removal-in-future.rst:76 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:80 +#: ../../deprecations/pending-removal-in-future.rst:79 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:82 +#: ../../deprecations/pending-removal-in-future.rst:81 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -224,7 +219,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:85 +#: ../../deprecations/pending-removal-in-future.rst:84 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 " @@ -236,12 +231,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 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:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -249,108 +244,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 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:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:113 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:115 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:117 +#: ../../deprecations/pending-removal-in-future.rst:116 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:118 +#: ../../deprecations/pending-removal-in-future.rst:117 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:120 +#: ../../deprecations/pending-removal-in-future.rst:119 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:122 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "" "The internal class ``typing._UnionGenericAlias`` is no longer used to " "implement :class:`typing.Union`. To preserve compatibility with users using " @@ -361,7 +356,7 @@ msgstr "" "了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " "shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -369,78 +364,78 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:134 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:137 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:141 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:144 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:145 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:147 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:152 +#: ../../deprecations/pending-removal-in-future.rst:151 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:157 +#: ../../deprecations/pending-removal-in-future.rst:156 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" diff --git a/extending/extending.po b/extending/extending.po index 452fcb6374..ec9327dda4 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,7 +113,7 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "我們檔案的前兩列可以為: ::" -#: ../../extending/extending.rst:60 ../../extending/extending.rst:681 +#: ../../extending/extending.rst:60 ../../extending/extending.rst:706 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -152,15 +152,86 @@ msgstr "" #: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " -"or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ````, ````, " -"````, and ````. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." +"or ``PY``, except those defined in standard header files." msgstr "" -#: ../../extending/extending.rst:85 +#: ../../extending/extending.rst:82 +msgid "" +"For backward compatibility, :file:`Python.h` includes several standard " +"header files. C extensions should include the standard headers that they " +"use, and should not rely on these implicit includes. If using the limited C " +"API version 3.13 or newer, the implicit includes are:" +msgstr "" + +#: ../../extending/extending.rst:87 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:88 +msgid "```` (on Windows)" +msgstr "````\\ (在 Windows 上)" + +#: ../../extending/extending.rst:89 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:90 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:91 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:92 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:93 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:94 +msgid "```` (if present)" +msgstr "````\\ (如果存在)" + +#: ../../extending/extending.rst:96 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or " +"older, the headers below are also included:" +msgstr "" + +#: ../../extending/extending.rst:99 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:100 +msgid "```` (on POSIX)" +msgstr "````\\ (在 POSIX 上)" + +#: ../../extending/extending.rst:102 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or " +"older, the headers below are also included:" +msgstr "" + +#: ../../extending/extending.rst:105 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:106 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:107 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:108 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:110 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " @@ -170,7 +241,7 @@ msgstr "" "system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它最後是" "如何被呼叫的): ::" -#: ../../extending/extending.rst:89 +#: ../../extending/extending.rst:114 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -196,7 +267,7 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:101 +#: ../../extending/extending.rst:126 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -206,7 +277,7 @@ msgstr "" "可以很直觀地從 Python 的引數串列(例如單一的運算式 ``\"ls -l\"``)直接轉換成" "傳給 C 函式的引數。C 函式總是有兩個引數,習慣上會命名為 *self* 和 *args*。" -#: ../../extending/extending.rst:106 +#: ../../extending/extending.rst:131 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." @@ -214,7 +285,7 @@ msgstr "" "對於模組層級的函式,*self* 引數會指向模組物件;而對於方法來說則是指向物件的實" "例。" -#: ../../extending/extending.rst:109 +#: ../../extending/extending.rst:134 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -231,7 +302,7 @@ msgstr "" "`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用模板字串來" "決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" -#: ../../extending/extending.rst:118 +#: ../../extending/extending.rst:143 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -245,11 +316,11 @@ msgstr "" "(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回傳 " "``NULL``\\ (就像我們在範例中所看到的)。" -#: ../../extending/extending.rst:128 +#: ../../extending/extending.rst:153 msgid "Intermezzo: Errors and Exceptions" msgstr "插曲:錯誤與例外" -#: ../../extending/extending.rst:130 +#: ../../extending/extending.rst:155 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -266,13 +337,13 @@ msgstr "" "們是由 :meth:`sys.exc_info` 所回傳的 Python 元組中的 C 等效元組。它們是例外型" "別、例外實例和回溯物件。了解它們對於理解錯誤是如何傳遞是很重要的。" -#: ../../extending/extending.rst:139 +#: ../../extending/extending.rst:164 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "Python API 定義了許多能夠設定各種類型例外的函式。" -#: ../../extending/extending.rst:141 +#: ../../extending/extending.rst:166 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -285,7 +356,7 @@ msgstr "" "指出錯誤的原因,並被轉換為 Python 字串物件且被儲存為例外的「關聯值 " "(associated value)」。" -#: ../../extending/extending.rst:147 +#: ../../extending/extending.rst:172 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -299,7 +370,7 @@ msgstr "" "`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需要對傳給任何" "這些函式的物件呼叫 :c:func:`Py_INCREF`。" -#: ../../extending/extending.rst:154 +#: ../../extending/extending.rst:179 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -311,7 +382,7 @@ msgstr "" "回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼叫 :c:" "func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就得知。" -#: ../../extending/extending.rst:160 +#: ../../extending/extending.rst:185 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -330,7 +401,7 @@ msgstr "" "首先檢測到它的函式回報了。一旦錯誤到達 Python 直譯器的主要迴圈,這會中止目前" "執行的 Python 程式碼,並嘗試尋找 Python 程式設計者指定的例外處理程式。" -#: ../../extending/extending.rst:170 +#: ../../extending/extending.rst:195 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -342,7 +413,7 @@ msgstr "" "息,在這種情況下這樣做是沒問題的。然而這一般來說並非必要,而且可能會導致錯誤" "原因資訊的遺失:大多數的操作都可能因為各種原因而失敗。)" -#: ../../extending/extending.rst:176 +#: ../../extending/extending.rst:201 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -355,7 +426,7 @@ msgstr "" "給直譯器而想要完全是自己來處理它時(可能是要再嘗試其他東西,或者假裝什麼都沒" "出錯)。" -#: ../../extending/extending.rst:182 +#: ../../extending/extending.rst:207 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -369,7 +440,7 @@ msgstr "" "`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼叫 :c:func:" "`malloc` 的函式有關。" -#: ../../extending/extending.rst:188 +#: ../../extending/extending.rst:213 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -380,7 +451,7 @@ msgstr "" "整數狀態的函式通常會回傳一個正值或 0 表示成功、回傳 ``-1`` 表示失敗,就像 " "Unix 系統呼叫一樣。" -#: ../../extending/extending.rst:192 +#: ../../extending/extending.rst:217 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " @@ -389,7 +460,7 @@ msgstr "" "最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼叫 :c:func:" "`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" -#: ../../extending/extending.rst:196 +#: ../../extending/extending.rst:221 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -409,7 +480,7 @@ msgstr "" "的值必須在一個特定的範圍內或必須滿足其他條件,則可以使用 :c:data:" "`PyExc_ValueError`。" -#: ../../extending/extending.rst:206 +#: ../../extending/extending.rst:231 msgid "" "You can also define a new exception that is unique to your module. The " "simplest way to do this is to declare a static global object variable at the " @@ -418,34 +489,34 @@ msgstr "" "你也可以定義一個你的模組特有的新例外。最簡單的方式是在檔案的開頭宣告一個靜態" "全域物件變數: ::" -#: ../../extending/extending.rst:210 +#: ../../extending/extending.rst:235 msgid "static PyObject *SpamError = NULL;" msgstr "static PyObject *SpamError = NULL;" -#: ../../extending/extending.rst:212 +#: ../../extending/extending.rst:237 msgid "" "and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:" "data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" -#: ../../extending/extending.rst:215 +#: ../../extending/extending.rst:240 msgid "SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);" msgstr "" -#: ../../extending/extending.rst:217 +#: ../../extending/extending.rst:242 msgid "" "Since :c:data:`!SpamError` is a global variable, it will be overwritten " "every time the module is reinitialized, when the :c:data:`Py_mod_exec` " "function is called." msgstr "" -#: ../../extending/extending.rst:220 +#: ../../extending/extending.rst:245 msgid "" "For now, let's avoid the issue: we will block repeated initialization by " "raising an :py:exc:`ImportError`::" msgstr "" -#: ../../extending/extending.rst:223 +#: ../../extending/extending.rst:248 msgid "" "static PyObject *SpamError = NULL;\n" "\n" @@ -484,7 +555,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:259 +#: ../../extending/extending.rst:284 msgid "" "Note that the Python name for the exception object is :exc:`!spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " @@ -495,7 +566,7 @@ msgstr "" "exceptions`\\ 所述,:c:func:`PyErr_NewException` 函式可能會建立一個基底類別" "為 :exc:`Exception` 的類別(除非傳入另一個類別來代替 ``NULL``)。" -#: ../../extending/extending.rst:264 +#: ../../extending/extending.rst:289 msgid "" "Note also that the :c:data:`!SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -511,7 +582,7 @@ msgstr "" "如果它變成迷途指標,那產生例外的 C 程式碼可能會導致核心轉儲 (core dump) 或其" "他不預期的 side effect。" -#: ../../extending/extending.rst:271 +#: ../../extending/extending.rst:296 msgid "" "For now, the :c:func:`Py_DECREF` call to remove this reference is missing. " "Even when the Python interpreter shuts down, the global :c:data:`!SpamError` " @@ -519,13 +590,13 @@ msgid "" "ensure that this will happen at most once per process." msgstr "" -#: ../../extending/extending.rst:276 +#: ../../extending/extending.rst:301 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." msgstr "我們稍後會討論 :c:macro:`PyMODINIT_FUNC` 作為函式回傳型別的用法。" -#: ../../extending/extending.rst:279 +#: ../../extending/extending.rst:304 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" @@ -533,7 +604,7 @@ msgstr "" "可以在你的擴充模組中呼叫 :c:func:`PyErr_SetString` 來引發 :exc:`!spam.error` " "例外,如下所示: ::" -#: ../../extending/extending.rst:282 +#: ../../extending/extending.rst:307 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -567,17 +638,17 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:302 +#: ../../extending/extending.rst:327 msgid "Back to the Example" msgstr "回到範例" -#: ../../extending/extending.rst:304 +#: ../../extending/extending.rst:329 msgid "" "Going back to our example function, you should now be able to understand " "this statement::" msgstr "回到我們的範例函式,現在你應該可以理解這個陳述式了: ::" -#: ../../extending/extending.rst:307 +#: ../../extending/extending.rst:332 msgid "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" @@ -585,7 +656,7 @@ msgstr "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" -#: ../../extending/extending.rst:310 +#: ../../extending/extending.rst:335 msgid "" "It returns ``NULL`` (the error indicator for functions returning object " "pointers) if an error is detected in the argument list, relying on the " @@ -601,7 +672,7 @@ msgstr "" "的字串(所以在標準 C 中,:c:data:`!command` 變數應該正確地被宣告為 ``const " "char *command``)。" -#: ../../extending/extending.rst:318 +#: ../../extending/extending.rst:343 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" @@ -609,11 +680,11 @@ msgstr "" "接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才從 :c:func:" "`PyArg_ParseTuple` 得到的字串傳給它:" -#: ../../extending/extending.rst:321 +#: ../../extending/extending.rst:346 msgid "sts = system(command);" msgstr "sts = system(command);" -#: ../../extending/extending.rst:323 +#: ../../extending/extending.rst:348 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " "a Python object. This is done using the function :c:func:" @@ -622,11 +693,11 @@ msgstr "" "我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" "sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" -#: ../../extending/extending.rst:326 +#: ../../extending/extending.rst:351 msgid "return PyLong_FromLong(sts);" msgstr "return PyLong_FromLong(sts);" -#: ../../extending/extending.rst:328 +#: ../../extending/extending.rst:353 msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" @@ -634,7 +705,7 @@ msgstr "" "在這種情況下它會回傳一個整數物件。(是的,在 Python 中連整數也是堆積 (heap) 上" "的物件!)" -#: ../../extending/extending.rst:331 +#: ../../extending/extending.rst:356 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " @@ -645,7 +716,7 @@ msgstr "" "應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成(由 :c:macro:" "`Py_RETURN_NONE` 巨集實作): ::" -#: ../../extending/extending.rst:336 +#: ../../extending/extending.rst:361 msgid "" "Py_INCREF(Py_None);\n" "return Py_None;" @@ -653,7 +724,7 @@ msgstr "" "Py_INCREF(Py_None);\n" "return Py_None;" -#: ../../extending/extending.rst:339 +#: ../../extending/extending.rst:364 msgid "" ":c:data:`Py_None` is the C name for the special Python object ``None``. It " "is a genuine Python object rather than a ``NULL`` pointer, which means " @@ -663,11 +734,11 @@ msgstr "" "Python 物件而不是一個 ``NULL`` 指標,在大多數的情況下它的意思是「錯誤」,如我" "們所見過的那樣。" -#: ../../extending/extending.rst:347 +#: ../../extending/extending.rst:372 msgid "The Module's Method Table and Initialization Function" msgstr "模組的方法表和初始化函式" -#: ../../extending/extending.rst:349 +#: ../../extending/extending.rst:374 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" @@ -675,7 +746,7 @@ msgstr "" "我承諾過要展示 :c:func:`!spam_system` 是如何從 Python 程式中呼叫的。首先,我" "們需要在「方法表」中列出它的名稱和位址: ::" -#: ../../extending/extending.rst:352 +#: ../../extending/extending.rst:377 msgid "" "static PyMethodDef spam_methods[] = {\n" " ...\n" @@ -693,7 +764,7 @@ msgstr "" " {NULL, NULL, 0, NULL} /* Sentinel */\n" "};" -#: ../../extending/extending.rst:360 +#: ../../extending/extending.rst:385 msgid "" "Note the third entry (``METH_VARARGS``). This is a flag telling the " "interpreter the calling convention to be used for the C function. It should " @@ -705,7 +776,7 @@ msgstr "" "標。通常應該是 ``METH_VARARGS`` 或 ``METH_VARARGS | METH_KEYWORDS``;``0`` 表" "示是使用 :c:func:`PyArg_ParseTuple` 的一個過時變體。" -#: ../../extending/extending.rst:365 +#: ../../extending/extending.rst:390 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" "level parameters to be passed in as a tuple acceptable for parsing via :c:" @@ -715,7 +786,7 @@ msgstr "" "能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" "提供。" -#: ../../extending/extending.rst:369 +#: ../../extending/extending.rst:394 msgid "" "The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword " "arguments should be passed to the function. In this case, the C function " @@ -728,12 +799,12 @@ msgstr "" "是關鍵字的字典。可使用 :c:func:`PyArg_ParseTupleAndKeywords` 來剖析這種函式的" "引數。" -#: ../../extending/extending.rst:375 +#: ../../extending/extending.rst:400 msgid "" "The method table must be referenced in the module definition structure::" msgstr "方法表必須在模組定義結構中被參照: ::" -#: ../../extending/extending.rst:377 +#: ../../extending/extending.rst:402 msgid "" "static struct PyModuleDef spam_module = {\n" " ...\n" @@ -742,7 +813,7 @@ msgid "" "};" msgstr "" -#: ../../extending/extending.rst:383 +#: ../../extending/extending.rst:408 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " "initialization function. The initialization function must be named :c:func:" @@ -753,7 +824,7 @@ msgstr "" "為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" "義的非「靜態 (``static``)」項目: ::" -#: ../../extending/extending.rst:388 +#: ../../extending/extending.rst:413 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -767,7 +838,7 @@ msgstr "" " return PyModuleDef_Init(&spam_module);\n" "}" -#: ../../extending/extending.rst:394 +#: ../../extending/extending.rst:419 msgid "" "Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` " "return type, declares any special linkage declarations required by the " @@ -776,7 +847,7 @@ msgstr "" "請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 ``PyObject *``、宣告平" "台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" -#: ../../extending/extending.rst:398 +#: ../../extending/extending.rst:423 msgid "" ":c:func:`!PyInit_spam` is called when each interpreter imports its module :" "mod:`!spam` for the first time. (See below for comments about embedding " @@ -785,7 +856,7 @@ msgid "" "store it in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:403 +#: ../../extending/extending.rst:428 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`!PyImport_Inittab` " @@ -796,7 +867,7 @@ msgstr "" "動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使用 :c:func:" "`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" -#: ../../extending/extending.rst:408 +#: ../../extending/extending.rst:433 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -898,7 +969,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../extending/extending.rst:458 +#: ../../extending/extending.rst:483 msgid "" "If you declare a global variable or a local static one, the module may " "experience unintended side-effects on re-initialisation, for example when " @@ -910,7 +981,7 @@ msgid "" "`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" -#: ../../extending/extending.rst:467 +#: ../../extending/extending.rst:492 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxlimited.c`. This file may be used as a " @@ -919,11 +990,11 @@ msgstr "" "Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/xxlimited." "c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" -#: ../../extending/extending.rst:475 +#: ../../extending/extending.rst:500 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:477 +#: ../../extending/extending.rst:502 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -933,7 +1004,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: ../../extending/extending.rst:484 +#: ../../extending/extending.rst:509 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -943,11 +1014,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:491 +#: ../../extending/extending.rst:516 msgid "spam spammodule.o" msgstr "spam spammodule.o" -#: ../../extending/extending.rst:495 +#: ../../extending/extending.rst:520 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -956,21 +1027,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:501 +#: ../../extending/extending.rst:526 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:504 +#: ../../extending/extending.rst:529 msgid "spam spammodule.o -lX11" msgstr "spam spammodule.o -lX11" -#: ../../extending/extending.rst:512 +#: ../../extending/extending.rst:537 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:514 +#: ../../extending/extending.rst:539 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -981,7 +1052,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:522 +#: ../../extending/extending.rst:547 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -990,7 +1061,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:528 +#: ../../extending/extending.rst:553 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -1000,7 +1071,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:535 +#: ../../extending/extending.rst:560 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -1027,7 +1098,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:558 +#: ../../extending/extending.rst:583 msgid "" "This function must be registered with the interpreter using the :c:macro:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -1035,7 +1106,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:563 +#: ../../extending/extending.rst:588 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -1043,7 +1114,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:570 +#: ../../extending/extending.rst:595 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -1055,7 +1126,7 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:579 +#: ../../extending/extending.rst:604 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -1069,7 +1140,7 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -#: ../../extending/extending.rst:590 +#: ../../extending/extending.rst:615 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -1078,7 +1149,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:597 +#: ../../extending/extending.rst:622 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -1087,7 +1158,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:603 +#: ../../extending/extending.rst:628 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -1098,7 +1169,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:611 +#: ../../extending/extending.rst:636 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -1106,7 +1177,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:616 +#: ../../extending/extending.rst:641 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -1118,7 +1189,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:625 +#: ../../extending/extending.rst:650 msgid "" "PyObject *arglist;\n" "...\n" @@ -1131,7 +1202,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:635 +#: ../../extending/extending.rst:660 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -1139,14 +1210,14 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:639 +#: ../../extending/extending.rst:664 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:643 +#: ../../extending/extending.rst:668 msgid "" "PyObject *dict;\n" "...\n" @@ -1159,19 +1230,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:657 +#: ../../extending/extending.rst:682 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:661 +#: ../../extending/extending.rst:686 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:663 +#: ../../extending/extending.rst:688 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -#: ../../extending/extending.rst:665 +#: ../../extending/extending.rst:690 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -1180,7 +1251,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:671 +#: ../../extending/extending.rst:696 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -1188,17 +1259,17 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:676 +#: ../../extending/extending.rst:701 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:679 +#: ../../extending/extending.rst:704 msgid "Some example calls::" msgstr "一些呼叫範例: ::" -#: ../../extending/extending.rst:686 +#: ../../extending/extending.rst:711 msgid "" "int ok;\n" "int i, j;\n" @@ -1218,27 +1289,27 @@ msgstr "" "ok = PyArg_ParseTuple(args, \"\"); /* 沒有引數 */\n" " /* Python 呼叫:f() */" -#: ../../extending/extending.rst:697 +#: ../../extending/extending.rst:722 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" -#: ../../extending/extending.rst:702 +#: ../../extending/extending.rst:727 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" -#: ../../extending/extending.rst:707 +#: ../../extending/extending.rst:732 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" -#: ../../extending/extending.rst:713 +#: ../../extending/extending.rst:738 msgid "" "{\n" " const char *file;\n" @@ -1253,7 +1324,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:727 +#: ../../extending/extending.rst:752 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1265,7 +1336,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:738 +#: ../../extending/extending.rst:763 msgid "" "{\n" " Py_complex c;\n" @@ -1275,16 +1346,16 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:749 +#: ../../extending/extending.rst:774 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:753 +#: ../../extending/extending.rst:778 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:755 +#: ../../extending/extending.rst:780 msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " @@ -1294,7 +1365,7 @@ msgstr "" " const char *format, char * const " "*kwlist, ...);" -#: ../../extending/extending.rst:758 +#: ../../extending/extending.rst:783 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -1306,20 +1377,20 @@ msgid "" "raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:768 +#: ../../extending/extending.rst:793 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:774 +#: ../../extending/extending.rst:799 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:777 +#: ../../extending/extending.rst:802 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1372,21 +1443,21 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:828 +#: ../../extending/extending.rst:853 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:830 +#: ../../extending/extending.rst:855 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:833 +#: ../../extending/extending.rst:858 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "PyObject *Py_BuildValue(const char *format, ...);" -#: ../../extending/extending.rst:835 +#: ../../extending/extending.rst:860 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -1394,7 +1465,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:840 +#: ../../extending/extending.rst:865 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -1406,12 +1477,12 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:848 +#: ../../extending/extending.rst:873 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:850 +#: ../../extending/extending.rst:875 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1449,11 +1520,11 @@ msgstr "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" -#: ../../extending/extending.rst:874 +#: ../../extending/extending.rst:899 msgid "Reference Counts" msgstr "參照計數" -#: ../../extending/extending.rst:876 +#: ../../extending/extending.rst:901 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -1462,7 +1533,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:882 +#: ../../extending/extending.rst:907 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -1477,7 +1548,7 @@ msgid "" "crashes." msgstr "" -#: ../../extending/extending.rst:893 +#: ../../extending/extending.rst:918 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -1494,7 +1565,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:906 +#: ../../extending/extending.rst:931 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -1505,7 +1576,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:914 +#: ../../extending/extending.rst:939 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -1521,7 +1592,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:926 +#: ../../extending/extending.rst:951 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1535,7 +1606,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:937 +#: ../../extending/extending.rst:962 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -1543,11 +1614,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:946 +#: ../../extending/extending.rst:971 msgid "Reference Counting in Python" msgstr "Python 中的參照計數" -#: ../../extending/extending.rst:948 +#: ../../extending/extending.rst:973 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -1558,7 +1629,7 @@ msgid "" "object." msgstr "" -#: ../../extending/extending.rst:955 +#: ../../extending/extending.rst:980 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -1571,7 +1642,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:964 +#: ../../extending/extending.rst:989 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -1580,7 +1651,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:970 +#: ../../extending/extending.rst:995 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -1591,7 +1662,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:978 +#: ../../extending/extending.rst:1003 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -1600,18 +1671,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:988 +#: ../../extending/extending.rst:1013 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:990 +#: ../../extending/extending.rst:1015 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:994 +#: ../../extending/extending.rst:1019 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -1622,7 +1693,7 @@ msgid "" "reference to a cached item." msgstr "" -#: ../../extending/extending.rst:1002 +#: ../../extending/extending.rst:1027 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -1633,14 +1704,14 @@ msgid "" "list or dictionary." msgstr "" -#: ../../extending/extending.rst:1009 +#: ../../extending/extending.rst:1034 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:1013 +#: ../../extending/extending.rst:1038 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -1651,7 +1722,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:1021 +#: ../../extending/extending.rst:1046 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -1660,18 +1731,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:1027 +#: ../../extending/extending.rst:1052 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1035 +#: ../../extending/extending.rst:1060 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1037 +#: ../../extending/extending.rst:1062 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -1679,14 +1750,14 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1041 +#: ../../extending/extending.rst:1066 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1044 +#: ../../extending/extending.rst:1069 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1706,14 +1777,14 @@ msgstr "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" -#: ../../extending/extending.rst:1053 +#: ../../extending/extending.rst:1078 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1057 +#: ../../extending/extending.rst:1082 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -1730,7 +1801,7 @@ msgid "" "`PyList_SetItem` call." msgstr "" -#: ../../extending/extending.rst:1071 +#: ../../extending/extending.rst:1096 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1741,13 +1812,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1079 +#: ../../extending/extending.rst:1104 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1082 +#: ../../extending/extending.rst:1107 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1771,14 +1842,14 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1093 +#: ../../extending/extending.rst:1118 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1097 +#: ../../extending/extending.rst:1122 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1791,7 +1862,7 @@ msgid "" "Obviously, the following function has the same problem as the previous one::" msgstr "" -#: ../../extending/extending.rst:1107 +#: ../../extending/extending.rst:1132 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1804,11 +1875,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1121 +#: ../../extending/extending.rst:1146 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1123 +#: ../../extending/extending.rst:1148 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1820,21 +1891,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1131 +#: ../../extending/extending.rst:1156 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1135 +#: ../../extending/extending.rst:1160 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1139 +#: ../../extending/extending.rst:1164 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1843,24 +1914,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1145 +#: ../../extending/extending.rst:1170 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1149 +#: ../../extending/extending.rst:1174 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1160 +#: ../../extending/extending.rst:1185 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1162 +#: ../../extending/extending.rst:1187 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1873,11 +1944,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1176 +#: ../../extending/extending.rst:1201 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1181 +#: ../../extending/extending.rst:1206 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1888,7 +1959,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1189 +#: ../../extending/extending.rst:1214 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1904,7 +1975,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1201 +#: ../../extending/extending.rst:1226 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1914,7 +1985,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1208 +#: ../../extending/extending.rst:1233 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1926,7 +1997,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1216 +#: ../../extending/extending.rst:1241 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1936,7 +2007,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1222 +#: ../../extending/extending.rst:1247 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -1946,17 +2017,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1229 +#: ../../extending/extending.rst:1254 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1232 +#: ../../extending/extending.rst:1257 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1234 +#: ../../extending/extending.rst:1259 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1964,7 +2035,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1239 +#: ../../extending/extending.rst:1264 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1975,7 +2046,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1272 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -1986,13 +2057,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1254 +#: ../../extending/extending.rst:1279 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1257 +#: ../../extending/extending.rst:1282 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -2006,11 +2077,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1263 +#: ../../extending/extending.rst:1288 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1265 +#: ../../extending/extending.rst:1290 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -2036,19 +2107,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1277 +#: ../../extending/extending.rst:1302 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1279 +#: ../../extending/extending.rst:1304 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1281 +#: ../../extending/extending.rst:1306 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1283 +#: ../../extending/extending.rst:1308 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -2056,7 +2127,7 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1286 +#: ../../extending/extending.rst:1311 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's :c:data:" @@ -2064,7 +2135,7 @@ msgid "" "pointer array::" msgstr "" -#: ../../extending/extending.rst:1290 +#: ../../extending/extending.rst:1315 msgid "" "static int\n" "spam_module_exec(PyObject *m)\n" @@ -2087,19 +2158,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1309 +#: ../../extending/extending.rst:1334 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1312 +#: ../../extending/extending.rst:1337 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1315 +#: ../../extending/extending.rst:1340 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2151,14 +2222,14 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1363 +#: ../../extending/extending.rst:1388 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" "import_spam` in its :c:data:`mod_exec ` function::" msgstr "" -#: ../../extending/extending.rst:1367 +#: ../../extending/extending.rst:1392 msgid "" "static int\n" "client_module_exec(PyObject *m)\n" @@ -2171,14 +2242,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1377 +#: ../../extending/extending.rst:1402 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1381 +#: ../../extending/extending.rst:1406 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -2188,89 +2259,47 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1389 +#: ../../extending/extending.rst:1414 msgid "Footnotes" msgstr "註腳" -#: ../../extending/extending.rst:1390 +#: ../../extending/extending.rst:1415 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1393 +#: ../../extending/extending.rst:1418 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1396 +#: ../../extending/extending.rst:1421 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1400 +#: ../../extending/extending.rst:1425 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: ../../extending/extending.rst:568 +#: ../../extending/extending.rst:593 msgid "PyObject_CallObject (C function)" msgstr "PyObject_CallObject(C 函式)" -#: ../../extending/extending.rst:659 +#: ../../extending/extending.rst:684 msgid "PyArg_ParseTuple (C function)" msgstr "PyArg_ParseTuple(C 函式)" -#: ../../extending/extending.rst:751 +#: ../../extending/extending.rst:776 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "PyArg_ParseTupleAndKeywords(C 函式)" -#: ../../extending/extending.rst:772 +#: ../../extending/extending.rst:797 msgid "Philbrick, Geoff" msgstr "Philbrick, Geoff" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (on Windows)" -#~ msgstr "````\\ (在 Windows 上)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (if present)" -#~ msgstr "````\\ (如果存在)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (on POSIX)" -#~ msgstr "````\\ (在 POSIX 上)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 73dfa0052d..f9af9cb62f 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -271,6 +271,10 @@ msgid "" " File \"\", line 1, in \n" "TypeError: can only concatenate str (not \"custom.Custom\") to str" msgstr "" +">>> \"\" + custom.Custom()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: can only concatenate str (not \"custom.Custom\") to str" #: ../../extending/newtypes_tutorial.rst:131 msgid "" diff --git a/faq/general.po b/faq/general.po index 16c2897ed6..b5ec25461d 100644 --- a/faq/general.po +++ b/faq/general.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-22 00:14+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-" @@ -83,14 +83,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 捐款" "頁面 `_\\ 為它做出貢獻。" @@ -334,9 +334,8 @@ msgid "" msgstr "" "請參閱\\ `開發人員指南 `__\\ 以獲得更多關於開發週期的資訊,並參閱 :pep:`387` 以瞭" -"解更多關於 Python 的向後相容性政策。另外,也請查" -"看 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys.version_info` 的" -"說明文件。" +"解更多關於 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?" @@ -348,9 +347,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 "" @@ -379,10 +378,10 @@ msgstr "我要如何取得 Python 的說明文件?" #: ../../faq/general.rst:188 msgid "" "The standard documentation for the current stable version of Python is " -"available at https://docs.python.org/3/. PDF, plain text, and downloadable " +"available at https://docs.python.org/3/. EPUB, plain text, and downloadable " "HTML versions are also available at https://docs.python.org/3/download.html." msgstr "" -"Python 目前穩定版本的標準說明文件可在 https://docs.python.org/3/ 找到。PDF、" +"Python 目前穩定版本的標準說明文件可在 https://docs.python.org/3/ 找到。EPUB、" "純文字和可下載的 HTML 版本也可在 https://docs.python.org/3/download.html 找" "到。" @@ -425,10 +424,9 @@ 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 中找到,這是一" @@ -463,9 +461,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 新聞群組上宣布,也" @@ -485,8 +483,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 的問題追蹤系統。" @@ -552,8 +550,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 基礎建設團隊管理。詳細資訊\\ `在" "此 `__。" @@ -565,8 +563,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 "" @@ -660,8 +658,8 @@ msgstr "有沒有任何重要的專案使用 Python 完成開發?" #: ../../faq/general.rst:333 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。藉" @@ -671,17 +669,17 @@ msgstr "" #: ../../faq/general.rst:338 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:347 msgid "What new developments are expected for Python in the future?" @@ -702,8 +700,8 @@ msgstr "" #: ../../faq/general.rst:355 msgid "" -"New development is discussed on `the python-dev mailing list `_." +"New development is discussed on `the python-dev mailing list `_." msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" diff --git a/faq/programming.po b/faq/programming.po index 3eb7dcd192..22e2872cb9 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -2796,7 +2796,6 @@ msgid "" msgstr "產生錯誤的是操作的賦值部分,因為元組是不可變的。" #: ../../faq/programming.rst:1382 -#, fuzzy msgid "When you write something like::" msgstr "當你寫這樣的東西時: ::" @@ -2808,6 +2807,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (['foo'], 'bar')\n" +">>> a_tuple[0] += ['item']\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1390 #, fuzzy diff --git a/howto/a-conceptual-overview-of-asyncio.po b/howto/a-conceptual-overview-of-asyncio.po index d816f8941e..9fdca88cc0 100644 --- a/howto/a-conceptual-overview-of-asyncio.po +++ b/howto/a-conceptual-overview-of-asyncio.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,63 +29,63 @@ msgstr "" #: ../../howto/a-conceptual-overview-of-asyncio.rst:11 msgid "" -"You might be curious about some key :mod:`!asyncio` concepts. You'll be " -"comfortably able to answer these questions by the end of this article:" +"You might be curious about some key :mod:`!asyncio` concepts. By the end of " +"this article, you'll be able to comfortably answer these questions:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:15 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:14 msgid "What's happening behind the scenes when an object is awaited?" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:16 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:15 msgid "" -"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU-" +"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU " "time (such as a network request or file read) as opposed to a task that does " "(such as computing n-factorial)?" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:19 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:18 msgid "" "How to write an asynchronous variant of an operation, such as an async sleep " "or database request." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:24 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:23 msgid "" "The `guide `_ that inspired this HOWTO article, by Alexander Nordin." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:26 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:25 msgid "" "This in-depth `YouTube tutorial series `_ on ``asyncio`` " "created by Python core team member, Łukasz Langa." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:29 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:28 msgid "" "`500 Lines or Less: A Web Crawler With asyncio Coroutines `_ by A. Jesse Jiryu " "Davis and Guido van Rossum." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:35 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:34 msgid "A conceptual overview part 1: the high-level" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:37 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:36 msgid "" "In part 1, we'll cover the main, high-level building blocks of :mod:`!" -"asyncio`: the event loop, coroutine functions, coroutine objects, tasks and " +"asyncio`: the event loop, coroutine functions, coroutine objects, tasks, and " "``await``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:42 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:41 msgid "Event Loop" msgstr "事件迴圈" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:44 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:43 msgid "" "Everything in :mod:`!asyncio` happens relative to the event loop. It's the " "star of the show. It's like an orchestra conductor. It's behind the scenes " @@ -94,7 +94,7 @@ msgid "" "worker bees." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:51 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:50 msgid "" "In more technical terms, the event loop contains a collection of jobs to be " "run. Some jobs are added directly by you, and some indirectly by :mod:`!" @@ -104,20 +104,20 @@ msgid "" "event loop will then select another job from its pool and invoke it. You can " "*roughly* think of the collection of jobs as a queue: jobs are added and " "then processed one at a time, generally (but not always) in order. This " -"process repeats indefinitely with the event loop cycling endlessly onwards. " +"process repeats indefinitely, with the event loop cycling endlessly onwards. " "If there are no more jobs pending execution, the event loop is smart enough " "to rest and avoid needlessly wasting CPU cycles, and will come back when " "there's more work to be done." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:65 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:64 msgid "" "Effective execution relies on jobs sharing well and cooperating; a greedy " "job could hog control and leave the other jobs to starve, rendering the " "overall event loop approach rather useless." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:71 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:70 msgid "" "import asyncio\n" "\n" @@ -127,15 +127,15 @@ msgid "" "event_loop.run_forever()" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:80 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:79 msgid "Asynchronous functions and coroutines" msgstr "非同步函式與協程" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:82 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:81 msgid "This is a basic, boring Python function::" msgstr "這是一個基本的、無聊的 Python 函式:" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:84 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:83 msgid "" "def hello_printer():\n" " print(\n" @@ -151,11 +151,11 @@ msgstr "" " \"partner in crime.\"\n" " )" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:91 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:90 msgid "Calling a regular function invokes its logic or body::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:93 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:92 msgid "" ">>> hello_printer()\n" "Hi, I am a lowly, simple printer, though I have all I need in life --\n" @@ -165,14 +165,14 @@ msgstr "" "Hi, I am a lowly, simple printer, though I have all I need in life --\n" "fresh paper and my dearly beloved octopus partner in crime." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:97 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:96 msgid "" "The :ref:`async def `, as opposed to just a plain ``def``, makes " "this an asynchronous function (or \"coroutine function\"). Calling it " "creates and returns a :ref:`coroutine ` object." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:103 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:102 msgid "" "async def loudmouth_penguin(magic_number: int):\n" " print(\n" @@ -188,13 +188,13 @@ msgstr "" " f\"By the way, my lucky number is: {magic_number}.\"\n" " )" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:109 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:108 msgid "" "Calling the async function, ``loudmouth_penguin``, does not execute the " "print statement; instead, it creates a coroutine object::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:112 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:111 msgid "" ">>> loudmouth_penguin(magic_number=3)\n" "" @@ -202,7 +202,7 @@ msgstr "" ">>> loudmouth_penguin(magic_number=3)\n" "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:115 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:114 msgid "" "The terms \"coroutine function\" and \"coroutine object\" are often " "conflated as coroutine. That can be confusing! In this article, coroutine " @@ -212,7 +212,7 @@ msgid "" "distinction that matters for type checking." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:124 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:123 msgid "" "A coroutine represents the function's body or logic. A coroutine has to be " "explicitly started; again, merely creating the coroutine does not start it. " @@ -221,7 +221,7 @@ msgid "" "asynchronous behavior!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:131 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:130 msgid "" "Coroutines and coroutine functions were built by leveraging the " "functionality of :term:`generators ` and :term:" @@ -229,7 +229,7 @@ msgid "" "function that :keyword:`yield`\\s, like this one::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:137 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:136 msgid "" "def get_random_number():\n" " # This would be a bad random number generator!\n" @@ -251,13 +251,13 @@ msgstr "" " yield 4\n" " ..." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:147 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:146 msgid "" "Similar to a coroutine function, calling a generator function does not run " "it. Instead, it creates a generator object::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:150 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:149 msgid "" ">>> get_random_number()\n" "" @@ -265,14 +265,14 @@ msgstr "" ">>> get_random_number()\n" "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:153 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:152 msgid "" "You can proceed to the next ``yield`` of a generator by using the built-in " "function :func:`next`. In other words, the generator runs, then pauses. For " "example::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:158 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:157 msgid "" ">>> generator = get_random_number()\n" ">>> next(generator)\n" @@ -290,11 +290,11 @@ msgstr "" "Hello\n" "7" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:168 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:167 msgid "Tasks" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:170 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:169 msgid "" "Roughly speaking, :ref:`tasks ` are coroutines (not " "coroutine functions) tied to an event loop. A task also maintains a list of " @@ -303,21 +303,21 @@ msgid "" "`asyncio.create_task`." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:176 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:175 msgid "" "Creating a task automatically schedules it for execution (by adding a " "callback to run it in the event loop's to-do list, that is, collection of " "jobs)." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:179 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:178 msgid "" "Since there's only one event loop (in each thread), :mod:`!asyncio` takes " "care of associating the task with the event loop for you. As such, there's " "no need to specify the event loop." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:185 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:184 msgid "" "coroutine = loudmouth_penguin(magic_number=5)\n" "# This creates a Task object and schedules its execution via the event " @@ -325,7 +325,7 @@ msgid "" "task = asyncio.create_task(coroutine)" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:189 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:188 msgid "" "Earlier, we manually created the event loop and set it to run forever. In " "practice, it's recommended to use (and common to see) :func:`asyncio.run`, " @@ -334,7 +334,7 @@ msgid "" "this setup::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:195 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:194 msgid "" "import asyncio\n" "\n" @@ -349,7 +349,7 @@ msgid "" " print(\"coroutine main() is done!\")" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:207 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:206 msgid "" "It's important to be aware that the task itself is not added to the event " "loop, only a callback to the task is. This matters if the task object you " @@ -357,7 +357,7 @@ msgid "" "example, consider this program:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:213 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:212 msgid "" "async def hello():\n" " print(\"hello!\")\n" @@ -371,7 +371,7 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:227 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:226 msgid "" "Because there's no reference to the task object created on line 5, it " "*might* be garbage collected before the event loop invokes it. Later " @@ -385,17 +385,17 @@ msgid "" "doesn't happen. But that's no reason to be reckless!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:243 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:242 msgid "await" msgstr "await" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:245 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:244 msgid "" ":keyword:`await` is a Python keyword that's commonly used in one of two " "different ways::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:248 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:247 msgid "" "await task\n" "await coroutine" @@ -403,20 +403,20 @@ msgstr "" "await task\n" "await coroutine" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:251 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:250 msgid "" "In a crucial way, the behavior of ``await`` depends on the type of object " "being awaited." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:254 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:253 msgid "" "Awaiting a task will cede control from the current task or coroutine to the " "event loop. In the process of relinquishing control, a few important things " "happen. We'll use the following code example to illustrate::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:259 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:258 msgid "" "async def plant_a_tree():\n" " dig_the_hole_task = asyncio.create_task(dig_the_hole())\n" @@ -426,7 +426,7 @@ msgid "" " ..." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:266 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:265 msgid "" "In this example, imagine the event loop has passed control to the start of " "the coroutine ``plant_a_tree()``. As seen above, the coroutine creates a " @@ -439,21 +439,21 @@ msgid "" "this case, a call to resume ``plant_a_tree()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:277 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:276 msgid "" "Generally speaking, when the awaited task finishes (``dig_the_hole_task``), " "the original task or coroutine (``plant_a_tree()``) is added back to the " -"event loops to-do list to be resumed." +"event loop's to-do list to be resumed." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:281 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:280 msgid "" "This is a basic, yet reliable mental model. In practice, the control " "handoffs are slightly more complex, but not by much. In part 2, we'll walk " "through the details that make this possible." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:285 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:284 msgid "" "**Unlike tasks, awaiting a coroutine does not hand control back to the event " "loop!** Wrapping a coroutine in a task first, then awaiting that would cede " @@ -461,7 +461,7 @@ msgid "" "invoking a regular, synchronous Python function. Consider this program::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:293 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:292 msgid "" "import asyncio\n" "\n" @@ -497,16 +497,16 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:310 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:309 msgid "" "The first statement in the coroutine ``main()`` creates ``task_b`` and " "schedules it for execution via the event loop. Then, ``coro_a()`` is " -"repeatedly awaited. Control never cedes to the event loop which is why we " +"repeatedly awaited. Control never cedes to the event loop, which is why we " "see the output of all three ``coro_a()`` invocations before ``coro_b()``'s " "output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:316 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:315 msgid "" "I am coro_a(). Hi!\n" "I am coro_a(). Hi!\n" @@ -518,7 +518,7 @@ msgstr "" "I am coro_a(). Hi!\n" "I am coro_b(). I sure hope no one hogs the event loop..." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:323 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:322 msgid "" "If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, " "the behavior changes. The coroutine ``main()`` cedes control to the event " @@ -527,7 +527,7 @@ msgid "" "before resuming the coroutine ``main()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:330 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:329 msgid "" "I am coro_b(). I sure hope no one hogs the event loop...\n" "I am coro_a(). Hi!\n" @@ -539,31 +539,31 @@ msgstr "" "I am coro_a(). Hi!\n" "I am coro_a(). Hi!" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:337 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:336 msgid "" "This behavior of ``await coroutine`` can trip a lot of people up! That " "example highlights how using only ``await coroutine`` could unintentionally " "hog control from other tasks and effectively stall the event loop. :func:" -"`asyncio.run` can help you detect such occurences via the ``debug=True`` " -"flag which accordingly enables :ref:`debug mode `. Among " -"other things, it will log any coroutines that monopolize execution for 100ms " -"or longer." +"`asyncio.run` can help you detect such occurrences via the ``debug=True`` " +"flag, which enables :ref:`debug mode `. Among other " +"things, it will log any coroutines that monopolize execution for 100ms or " +"longer." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:347 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:346 msgid "" "The design intentionally trades off some conceptual clarity around usage of " "``await`` for improved performance. Each time a task is awaited, control " "needs to be passed all the way up the call stack to the event loop. That " -"might sound minor, but in a large program with many ``await``'s and a deep " -"callstack that overhead can add up to a meaningful performance drag." +"might sound minor, but in a large program with many ``await`` statements and " +"a deep call stack, that overhead can add up to a meaningful performance drag." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:356 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:355 msgid "A conceptual overview part 2: the nuts and bolts" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:358 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:357 msgid "" "Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage " "control flow. This is where the magic happens. You'll come away from this " @@ -571,24 +571,24 @@ msgid "" "own asynchronous operators." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:366 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:365 msgid "The inner workings of coroutines" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:368 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:367 msgid ":mod:`!asyncio` leverages four components to pass around control." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:370 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:369 msgid "" ":meth:`coroutine.send(arg) ` is the method used to start or " "resume a coroutine. If the coroutine was paused and is now being resumed, " "the argument ``arg`` will be sent in as the return value of the ``yield`` " "statement which originally paused it. If the coroutine is being used for the " -"first time (as opposed to being resumed) ``arg`` must be ``None``." +"first time (as opposed to being resumed), ``arg`` must be ``None``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:378 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:377 msgid "" "class Rock:\n" " def __await__(self):\n" @@ -642,18 +642,18 @@ msgstr "" " returned_value = e.value\n" "print(f\"Coroutine main() finished and provided value: {returned_value}.\")" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:406 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:405 msgid "" -":ref:`yield `, like usual, pauses execution and returns control " -"to the caller. In the example above, the ``yield``, on line 3, is called by " +":ref:`yield `, as usual, pauses execution and returns control to " +"the caller. In the example above, the ``yield``, on line 3, is called by " "``... = await rock`` on line 11. More broadly speaking, ``await`` calls the :" "meth:`~object.__await__` method of the given object. ``await`` also does one " "more very special thing: it propagates (or \"passes along\") any ``yield``\\ " -"s it receives up the call-chain. In this case, that's back to ``... = " +"s it receives up the call chain. In this case, that's back to ``... = " "coroutine.send(None)`` on line 16." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:416 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:415 msgid "" "The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The " "coroutine picks back up from where it ``yield``\\ ed (or paused) on line 3 " @@ -662,11 +662,11 @@ msgid "" "attached in the :attr:`~StopIteration.value` attribute." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:422 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:421 msgid "That snippet produces this output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:424 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:423 msgid "" "Beginning coroutine main().\n" "Awaiting rock...\n" @@ -684,28 +684,28 @@ msgstr "" "Coroutine received value: 42 from rock.\n" "Coroutine main() finished and provided value: 23." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:434 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:433 msgid "" "It's worth pausing for a moment here and making sure you followed the " "various ways that control flow and values were passed. A lot of important " "ideas were covered and it's worth ensuring your understanding is firm." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:438 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:437 msgid "" "The only way to yield (or effectively cede control) from a coroutine is to " "``await`` an object that ``yield``\\ s in its ``__await__`` method. That " "might sound odd to you. You might be thinking:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:442 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:441 msgid "" "1. What about a ``yield`` directly within the coroutine function? The " "coroutine function becomes an :ref:`async generator function `, a different beast entirely." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:447 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:446 msgid "" "2. What about a :ref:`yield from ` within the coroutine function " "to a (plain) generator? That causes the error: ``SyntaxError: yield from not " @@ -716,11 +716,11 @@ msgid "" "same thing." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:458 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:457 msgid "Futures" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:460 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:459 msgid "" "A :ref:`future ` is an object meant to represent a " "computation's status and result. The term is a nod to the idea of something " @@ -728,17 +728,17 @@ msgid "" "that something." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:465 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:464 msgid "" -"A future has a few important attributes. One is its state which can be " -"either \"pending\", \"cancelled\" or \"done\". Another is its result, which " +"A future has a few important attributes. One is its state, which can be " +"either \"pending\", \"cancelled\", or \"done\". Another is its result, which " "is set when the state transitions to done. Unlike a coroutine, a future does " "not represent the actual computation to be done; instead, it represents the " "status and result of that computation, kind of like a status light (red, " -"yellow or green) or indicator." +"yellow, or green) or indicator." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:472 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:471 msgid "" ":class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain " "these various capabilities. The prior section said tasks store a list of " @@ -746,7 +746,7 @@ msgid "" "class that implements this logic, which ``Task`` inherits." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:479 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:478 msgid "" "Futures may also be used directly (not via tasks). Tasks mark themselves as " "done when their coroutine is complete. Futures are much more versatile and " @@ -754,26 +754,26 @@ msgid "" "interface for you to make your own conditions for waiting and resuming." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:487 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:486 msgid "A homemade asyncio.sleep" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:489 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:488 msgid "" "We'll go through an example of how you could leverage a future to create " "your own variant of asynchronous sleep (``async_sleep``) which mimics :func:" "`asyncio.sleep`." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:493 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:492 msgid "" -"This snippet registers a few tasks with the event loop and then awaits a " -"coroutine wrapped in a task: ``async_sleep(3)``. We want that task to finish " -"only after three seconds have elapsed, but without preventing other tasks " -"from running." +"This snippet registers a few tasks with the event loop and then awaits the " +"task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` " +"coroutine. We want that task to finish only after three seconds have " +"elapsed, but without preventing other tasks from running." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:500 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:499 msgid "" "async def other_work():\n" " print(\"I like work. Work work.\")\n" @@ -799,7 +799,7 @@ msgid "" " await asyncio.gather(*work_tasks)" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:524 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:523 msgid "" "Below, we use a future to enable custom control over when that task will be " "marked as done. If :meth:`future.set_result() ` " @@ -809,7 +809,7 @@ msgid "" "elapsed and, accordingly, call ``future.set_result()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:535 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:534 msgid "" "async def async_sleep(seconds: float):\n" " future = asyncio.Future()\n" @@ -821,31 +821,31 @@ msgid "" " await future" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:543 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:542 msgid "" -"Below, we'll use a rather bare object, ``YieldToEventLoop()``, to ``yield`` " -"from ``__await__`` in order to cede control to the event loop. This is " +"Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield`` from " +"its ``__await__`` method, ceding control to the event loop. This is " "effectively the same as calling ``asyncio.sleep(0)``, but this approach " "offers more clarity, not to mention it's somewhat cheating to use ``asyncio." "sleep`` when showcasing how to implement it!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:549 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:548 msgid "" "As usual, the event loop cycles through its tasks, giving them control and " "receiving control back when they pause or finish. The ``watcher_task``, " "which runs the coroutine ``_sleep_watcher(...)``, will be invoked once per " "full cycle of the event loop. On each resumption, it'll check the time and " "if not enough has elapsed, then it'll pause once again and hand control back " -"to the event loop. Eventually, enough time will have elapsed, and " -"``_sleep_watcher(...)`` will mark the future as done, and then itself finish " -"too by breaking out of the infinite ``while`` loop. Given this helper task " -"is only invoked once per cycle of the event loop, you'd be correct to note " -"that this asynchronous sleep will sleep *at least* three seconds, rather " -"than exactly three seconds. Note this is also of true of ``asyncio.sleep``." +"to the event loop. Once enough time has elapsed, ``_sleep_watcher(...)`` " +"marks the future as done and completes by exiting its infinite ``while`` " +"loop. Given this helper task is only invoked once per cycle of the event " +"loop, you'd be correct to note that this asynchronous sleep will sleep *at " +"least* three seconds, rather than exactly three seconds. Note this is also " +"true of ``asyncio.sleep``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:565 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:564 msgid "" "class YieldToEventLoop:\n" " def __await__(self):\n" @@ -861,11 +861,11 @@ msgid "" " await YieldToEventLoop()" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:578 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:577 msgid "Here is the full program's output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:580 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:579 msgid "" "$ python custom-async-sleep.py\n" "Beginning asynchronous sleep at time: 14:52:22.\n" @@ -881,7 +881,7 @@ msgstr "" "I like work. Work work.\n" "Done asynchronous sleep at time: 14:52:25." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:589 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:588 msgid "" "You might feel this implementation of asynchronous sleep was unnecessarily " "convoluted. And, well, it was. The example was meant to showcase the " @@ -890,7 +890,7 @@ msgid "" "so::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:596 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:595 msgid "" "async def simpler_async_sleep(seconds):\n" " time_to_wake = time.time() + seconds\n" @@ -908,9 +908,9 @@ msgstr "" " else:\n" " await YieldToEventLoop()" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:604 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:603 msgid "" -"But, that's all for now. Hopefully you're ready to more confidently dive " -"into some async programming or check out advanced topics in the :mod:`rest " -"of the documentation `." +"But that's all for now. Hopefully you're ready to more confidently dive into " +"some async programming or check out advanced topics in the :mod:`rest of the " +"documentation `." msgstr "" diff --git a/howto/enum.po b/howto/enum.po index 36d792394f..cbddd1538c 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1018,6 +1018,15 @@ msgid "" ">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" "True" msgstr "" +">>> @dataclass # 不要這樣做,這並不合理\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # 問題在此:它們不應該相等\n" +"True" #: ../../howto/enum.rst:529 msgid "Pickling" @@ -2146,6 +2155,16 @@ msgid "" ">>> (Perm.R & Perm.W).name is None # effectively Perm(0)\n" "True" msgstr "" +">>> (Color.RED | Color.GREEN).name\n" +"'RED|GREEN'\n" +"\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> (Perm.R & Perm.W).name is None # 效果為 Perm(0)\n" +"True" #: ../../howto/enum.rst:1164 msgid "multi-bit flags, aka aliases, can be returned from operations::" @@ -2557,6 +2576,13 @@ msgid "" "... return obj\n" "..." msgstr "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls, *args): # 這是和上面相比唯一的變更\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"..." #: ../../howto/enum.rst:1382 msgid "" @@ -2700,6 +2726,26 @@ msgid "" " ...\n" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" +">>> class DuplicateFreeEnum(Enum):\n" +"... def __init__(self, *args):\n" +"... cls = self.__class__\n" +"... if any(self.value == e.value for e in cls):\n" +"... a = self.name\n" +"... e = cls(self.value).name\n" +"... raise ValueError(\n" +"... \"aliases not allowed in DuplicateFreeEnum: %r --> " +"%r\"\n" +"... % (a, e))\n" +"...\n" +">>> class Color(DuplicateFreeEnum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... GRENE = 2\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" #: ../../howto/enum.rst:1477 msgid "" @@ -2787,6 +2833,28 @@ msgid "" ">>> Planet.EARTH.surface_gravity\n" "9.802652743337129" msgstr "" +">>> class Planet(Enum):\n" +"... MERCURY = (3.303e+23, 2.4397e6)\n" +"... VENUS = (4.869e+24, 6.0518e6)\n" +"... EARTH = (5.976e+24, 6.37814e6)\n" +"... MARS = (6.421e+23, 3.3972e6)\n" +"... JUPITER = (1.9e+27, 7.1492e7)\n" +"... SATURN = (5.688e+26, 6.0268e7)\n" +"... URANUS = (8.686e+25, 2.5559e7)\n" +"... NEPTUNE = (1.024e+26, 2.4746e7)\n" +"... def __init__(self, mass, radius):\n" +"... self.mass = mass # 以公斤表示\n" +"... self.radius = radius # 以公尺表示\n" +"... @property\n" +"... def surface_gravity(self):\n" +"... # 萬有引力常數 (m3 kg-1 s-2)\n" +"... G = 6.67300E-11\n" +"... return G * self.mass / (self.radius * self.radius)\n" +"...\n" +">>> Planet.EARTH.value\n" +"(5.976e+24, 6378140.0)\n" +">>> Planet.EARTH.surface_gravity\n" +"9.802652743337129" #: ../../howto/enum.rst:1537 msgid "TimePeriod" diff --git a/howto/functional.po b/howto/functional.po index 1be2a0486f..85b44dc8cb 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -1018,6 +1018,15 @@ msgid "" ">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" +">>> import random\n" +">>> # 產生 8 個範圍在 [0, 10000) 的隨機數字\n" +">>> rand_list = random.sample(range(10000), 8)\n" +">>> rand_list\n" +"[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" +">>> sorted(rand_list)\n" +"[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" +">>> sorted(rand_list, reverse=True)\n" +"[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" #: ../../howto/functional.rst:698 msgid "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 9464ff1c9d..468e64d841 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -631,7 +631,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:418 msgid "Defining ``tp_dealloc``" -msgstr "" +msgstr "定義 ``tp_dealloc``" #: ../../howto/isolating-extensions.rst:420 msgid "" @@ -692,7 +692,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:452 msgid "Avoiding ``PyObject_New``" -msgstr "" +msgstr "避免使用 ``PyObject_New``" #: ../../howto/isolating-extensions.rst:454 msgid "GC-tracked objects need to be allocated using GC-aware functions." @@ -843,7 +843,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:538 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../howto/isolating-extensions.rst:540 msgid "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 9d926063b6..15d2b2fcd6 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -2167,6 +2167,27 @@ msgid "" "2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" ">>>" msgstr "" +">>> import logging\n" +">>> root = logging.getLogger()\n" +">>> root.setLevel(logging.DEBUG)\n" +">>> handler = logging.StreamHandler()\n" +">>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',\n" +"... style='{')\n" +">>> handler.setFormatter(bf)\n" +">>> root.addHandler(handler)\n" +">>> logger = logging.getLogger('foo.bar')\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:11:55,341 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message\n" +">>> df = logging.Formatter('$asctime $name ${levelname} $message',\n" +"... style='$')\n" +">>> handler.setFormatter(df)\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" +">>>" #: ../../howto/logging-cookbook.rst:1669 msgid "" @@ -2181,6 +2202,9 @@ msgid "" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" +">>> 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" +">>>" #: ../../howto/logging-cookbook.rst:1677 msgid "" @@ -2281,6 +2305,21 @@ msgid "" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> from wherever import BraceMessage as __\n" +">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',\n" +"... point=p))\n" +"Message with coordinates: (0.50, 0.50)\n" +">>> from wherever import DollarMessage as __\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:1744 msgid "" @@ -3679,6 +3718,17 @@ msgid "" "point=p))\n" "Message with coordinates: (0.50, 0.50)" msgstr "" +">>> __ = BraceMessage\n" +">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', " +"point=p))\n" +"Message with coordinates: (0.50, 0.50)" #: ../../howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" @@ -3691,6 +3741,10 @@ msgid "" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> __ = DollarMessage\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:2831 msgid "" diff --git a/howto/sorting.po b/howto/sorting.po index 40f6d215fc..7455a8b96f 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -594,6 +594,9 @@ msgid "" ">>> sorted(map(str, data))\n" "['10', '11', 'twelve']" msgstr "" +">>> data = ['twelve', '11', 10]\n" +">>> sorted(map(str, data))\n" +"['10', '11', 'twelve']" #: ../../howto/sorting.rst:292 msgid "" @@ -612,6 +615,11 @@ msgid "" ">>> sorted(filterfalse(isnan, data))\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +">>> data = [3.3, float('nan'), 1.1, 2.2]\n" +">>> sorted(filterfalse(isnan, data))\n" +"[1.1, 2.2, 3.3]" #: ../../howto/sorting.rst:305 msgid "" @@ -630,6 +638,9 @@ msgid "" ">>> sorted(x for x in data if x is not None)\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> data = [3.3, None, 1.1, 2.2]\n" +">>> sorted(x for x in data if x is not None)\n" +"[1.1, 2.2, 3.3]" #: ../../howto/sorting.rst:317 msgid "This is needed because ``None`` is not comparable to other types." @@ -645,6 +656,9 @@ msgid "" ">>> sorted(data, key=lambda d: sorted(d.items()))\n" "[{'a': 1}, {'b': 2}]" msgstr "" +">>> data = [{'a': 1}, {'b': 2}]\n" +">>> sorted(data, key=lambda d: sorted(d.items()))\n" +"[{'a': 1}, {'b': 2}]" #: ../../howto/sorting.rst:327 msgid "" @@ -661,6 +675,9 @@ msgid "" ">>> sorted(map(sorted, data))\n" "[['a', 'b', 'c'], ['b', 'c', 'd']]" msgstr "" +">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" +">>> sorted(map(sorted, data))\n" +"[['a', 'b', 'c'], ['b', 'c', 'd']]" #: ../../howto/sorting.rst:338 msgid "" diff --git a/howto/unicode.po b/howto/unicode.po index 7d33256d99..ebe70ac614 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -556,6 +556,12 @@ msgid "" ">>> [ord(c) for c in s]\n" "[97, 172, 4660, 8364, 32768]" msgstr "" +">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" +"... # ^^^^ two-digit hex escape\n" +"... # ^^^^^^ four-digit Unicode escape\n" +"... # ^^^^^^^^^^ eight-digit Unicode escape\n" +">>> [ord(c) for c in s]\n" +"[97, 172, 4660, 8364, 32768]" #: ../../howto/unicode.rst:324 msgid "" diff --git a/library/annotationlib.po b/library/annotationlib.po index 6725f78e2f..93d55b02d9 100644 --- a/library/annotationlib.po +++ b/library/annotationlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-22 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,17 +18,16 @@ msgstr "" #: ../../library/annotationlib.rst:2 msgid ":mod:`!annotationlib` --- Functionality for introspecting annotations" -msgstr "" +msgstr ":mod:`!annotationlib` --- 用於自我檢查註釋的功能" #: ../../library/annotationlib.rst:9 msgid "**Source code:** :source:`Lib/annotationlib.py`" -msgstr "" +msgstr "**原始碼:** :source:`Lib/annotationlib.py`" #: ../../library/annotationlib.rst:18 msgid "" -"The :mod:`!annotationlib` module provides tools for " -"introspecting :term:`annotations ` on modules, classes, and " -"functions." +"The :mod:`!annotationlib` module provides tools for introspecting :term:" +"`annotations ` on modules, classes, and functions." msgstr "" #: ../../library/annotationlib.rst:21 @@ -42,8 +41,8 @@ msgstr "" #: ../../library/annotationlib.rst:26 msgid "" -"This module supports retrieving annotations in three main formats " -"(see :class:`Format`), each of which works best for different use cases:" +"This module supports retrieving annotations in three main formats (see :" +"class:`Format`), each of which works best for different use cases:" msgstr "" #: ../../library/annotationlib.rst:29 @@ -74,10 +73,9 @@ msgid "" "annotations. Given a function, class, or module, it returns an annotations " "dictionary in the requested format. This module also provides functionality " "for working directly with the :term:`annotate function` that is used to " -"evaluate annotations, such as :func:`get_annotate_from_class_namespace` " -"and :func:`call_annotate_function`, as well as " -"the :func:`call_evaluate_function` function for working with :term:`evaluate " -"functions `." +"evaluate annotations, such as :func:`get_annotate_from_class_namespace` and :" +"func:`call_annotate_function`, as well as the :func:`call_evaluate_function` " +"function for working with :term:`evaluate functions `." msgstr "" #: ../../library/annotationlib.rst:51 @@ -93,8 +91,8 @@ msgstr "" #: ../../library/annotationlib.rst:58 msgid "" -":pep:`749` expanded on various aspects of :pep:`649` and introduced " -"the :mod:`!annotationlib` module." +":pep:`749` expanded on various aspects of :pep:`649` and introduced the :mod:" +"`!annotationlib` module." msgstr "" #: ../../library/annotationlib.rst:61 @@ -122,9 +120,9 @@ msgstr "" #: ../../library/annotationlib.rst:74 msgid "" -"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` " -"and :pep:`526`): Annotations are evaluated eagerly, as they are encountered " -"in the source code." +"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` and :" +"pep:`526`): Annotations are evaluated eagerly, as they are encountered in " +"the source code." msgstr "" #: ../../library/annotationlib.rst:77 @@ -136,9 +134,8 @@ msgstr "" #: ../../library/annotationlib.rst:80 msgid "" -"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` " -"and :pep:`749`): Annotations are evaluated lazily, only when they are " -"accessed." +"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` and :" +"pep:`749`): Annotations are evaluated lazily, only when they are accessed." msgstr "" #: ../../library/annotationlib.rst:83 @@ -161,9 +158,9 @@ msgstr "" #: ../../library/annotationlib.rst:94 msgid "" -"Under stock semantics (Python 3.13 and earlier), it will throw " -"a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is " -"an undefined name at that point." +"Under stock semantics (Python 3.13 and earlier), it will throw a :exc:" +"`NameError` at the line where ``func`` is defined, because ``Cls`` is an " +"undefined name at that point." msgstr "" #: ../../library/annotationlib.rst:97 @@ -219,11 +216,10 @@ msgstr "" msgid "" "Special value used to signal that an annotate function is being evaluated in " "a special environment with fake globals. When passed this value, annotate " -"functions should either return the same value as for " -"the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError` to " -"signal that they do not support execution in this environment. This format " -"is only used internally and should not be passed to the functions in this " -"module." +"functions should either return the same value as for the :attr:`Format." +"VALUE` format, or raise :exc:`NotImplementedError` to signal that they do " +"not support execution in this environment. This format is only used " +"internally and should not be passed to the functions in this module." msgstr "" #: ../../library/annotationlib.rst:149 @@ -259,9 +255,9 @@ msgstr "" #: ../../library/annotationlib.rst:176 msgid "" -"A string containing the code that was evaluated to produce " -"the :class:`~ForwardRef`. The string may not be exactly equivalent to the " -"original source." +"A string containing the code that was evaluated to produce the :class:" +"`~ForwardRef`. The string may not be exactly equivalent to the original " +"source." msgstr "" #: ../../library/annotationlib.rst:182 @@ -279,9 +275,8 @@ msgid "" "example, if the forward reference object contains the code " "``list[undefined]``, where ``undefined`` is a name that is not defined, " "evaluating it with the :attr:`~Format.FORWARDREF` format will return " -"``list[ForwardRef('undefined')]``. If the *format* argument " -"is :attr:`~Format.STRING`, the method will " -"return :attr:`~ForwardRef.__forward_arg__`." +"``list[ForwardRef('undefined')]``. If the *format* argument is :attr:" +"`~Format.STRING`, the method will return :attr:`~ForwardRef.__forward_arg__`." msgstr "" #: ../../library/annotationlib.rst:196 @@ -295,15 +290,15 @@ msgstr "" #: ../../library/annotationlib.rst:201 msgid "" "The *globals*, *locals*, and *type_params* parameters provide a more precise " -"mechanism for influencing the names that are available when " -"the :class:`~ForwardRef` is evaluated. *globals* and *locals* are passed " -"to :func:`eval`, representing the global and local namespaces in which the " -"name is evaluated. The *type_params* parameter is relevant for objects " -"created using the native syntax for :ref:`generic classes ` " -"and :ref:`functions `. It is a tuple of :ref:`type " -"parameters ` that are in scope while the forward reference is " -"being evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved " -"from an annotation found in the class namespace of a generic class ``C``, " +"mechanism for influencing the names that are available when the :class:" +"`~ForwardRef` is evaluated. *globals* and *locals* are passed to :func:" +"`eval`, representing the global and local namespaces in which the name is " +"evaluated. The *type_params* parameter is relevant for objects created using " +"the native syntax for :ref:`generic classes ` and :ref:" +"`functions `. It is a tuple of :ref:`type parameters " +"` that are in scope while the forward reference is being " +"evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved from " +"an annotation found in the class namespace of a generic class ``C``, " "*type_params* should be set to ``C.__type_params__``." msgstr "" @@ -319,9 +314,9 @@ msgstr "" #: ../../library/annotationlib.rst:219 msgid "" -"If no *owner*, *globals*, *locals*, or *type_params* are provided and " -"the :class:`~ForwardRef` does not contain information about its origin, " -"empty globals and locals dictionaries are used." +"If no *owner*, *globals*, *locals*, or *type_params* are provided and the :" +"class:`~ForwardRef` does not contain information about its origin, empty " +"globals and locals dictionaries are used." msgstr "" #: ../../library/annotationlib.rst:227 @@ -339,8 +334,8 @@ msgstr "" #: ../../library/annotationlib.rst:238 msgid "" -"For example, this is used to implement the :attr:`~Format.STRING` " -"for :class:`typing.TypedDict` classes created through the functional syntax:" +"For example, this is used to implement the :attr:`~Format.STRING` for :class:" +"`typing.TypedDict` classes created through the functional syntax:" msgstr "" #: ../../library/annotationlib.rst:241 @@ -350,6 +345,10 @@ msgid "" ">>> get_annotations(Movie, format=Format.STRING)\n" "{'name': 'str', 'year': 'int'}" msgstr "" +">>> from typing import TypedDict\n" +">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" +">>> get_annotations(Movie, format=Format.STRING)\n" +"{'name': 'str', 'year': 'int'}" #: ../../library/annotationlib.rst:252 msgid "" @@ -361,12 +360,12 @@ msgstr "" #: ../../library/annotationlib.rst:256 msgid "" "This helper function is required because annotate functions generated by the " -"compiler for functions, classes, and modules only support " -"the :attr:`~Format.VALUE` format when called directly. To support other " -"formats, this function calls the annotate function in a special environment " -"that allows it to produce annotations in the other formats. This is a useful " -"building block when implementing functionality that needs to partially " -"evaluate annotations while a class is being constructed." +"compiler for functions, classes, and modules only support the :attr:`~Format." +"VALUE` format when called directly. To support other formats, this function " +"calls the annotate function in a special environment that allows it to " +"produce annotations in the other formats. This is a useful building block " +"when implementing functionality that needs to partially evaluate annotations " +"while a class is being constructed." msgstr "" #: ../../library/annotationlib.rst:265 @@ -469,9 +468,9 @@ msgstr "" #: ../../library/annotationlib.rst:333 msgid "" -"*obj* may be a callable, class, module, or other object " -"with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` " -"attributes. Passing any other object raises :exc:`TypeError`." +"*obj* may be a callable, class, module, or other object with :attr:`~object." +"__annotate__` or :attr:`~object.__annotations__` attributes. Passing any " +"other object raises :exc:`TypeError`." msgstr "" #: ../../library/annotationlib.rst:337 @@ -487,34 +486,54 @@ msgid "" "exist, the :attr:`!object.__annotate__` function is called if it exists." msgstr "" -#: ../../library/annotationlib.rst:343 +#: ../../library/annotationlib.rst:344 msgid "" "FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " "successfully, it is used; otherwise, the :attr:`!object.__annotate__` " -"function is called. If it does not exist either, :attr:`!" -"object.__annotations__` is tried again and any error from accessing it is re-" -"raised." +"function is called. If it does not exist either, :attr:`!object." +"__annotations__` is tried again and any error from accessing it is re-raised." +msgstr "" + +#: ../../library/annotationlib.rst:349 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.FORWARDREF`. If this is not implemented, it will then check if :" +"attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE`. If :attr:`~Format.VALUE` fails, the " +"error from this call will be raised." msgstr "" -#: ../../library/annotationlib.rst:347 +#: ../../library/annotationlib.rst:355 msgid "" "STRING: If :attr:`!object.__annotate__` exists, it is called first; " -"otherwise, :attr:`!object.__annotations__` is used and stringified " -"using :func:`annotations_to_string`." +"otherwise, :attr:`!object.__annotations__` is used and stringified using :" +"func:`annotations_to_string`." +msgstr "" + +#: ../../library/annotationlib.rst:359 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.STRING`. If this is not implemented, it will then check if :attr:" +"`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE` with the result converted using :func:" +"`annotations_to_string`. If :attr:`~Format.VALUE` fails, the error from this " +"call will be raised." msgstr "" -#: ../../library/annotationlib.rst:351 +#: ../../library/annotationlib.rst:366 msgid "" "Returns a dict. :func:`!get_annotations` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/annotationlib.rst:355 +#: ../../library/annotationlib.rst:370 msgid "This function handles several details for you:" msgstr "" -#: ../../library/annotationlib.rst:357 +#: ../../library/annotationlib.rst:372 msgid "" "If *eval_str* is true, values of type :class:`!str` will be un-stringized " "using :func:`eval`. This is intended for use with stringized annotations " @@ -522,47 +541,47 @@ msgid "" "to true with formats other than :attr:`Format.VALUE`." msgstr "" -#: ../../library/annotationlib.rst:362 +#: ../../library/annotationlib.rst:377 msgid "" "If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " "and methods always have an annotations dict; classes, modules, and other " "types of callables may not.)" msgstr "" -#: ../../library/annotationlib.rst:366 +#: ../../library/annotationlib.rst:381 msgid "" "Ignores inherited annotations on classes, as well as annotations on " "metaclasses. If a class doesn't have its own annotations dict, returns an " "empty dict." msgstr "" -#: ../../library/annotationlib.rst:369 +#: ../../library/annotationlib.rst:384 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/annotationlib.rst:372 +#: ../../library/annotationlib.rst:387 msgid "" "*eval_str* controls whether or not values of type :class:`!str` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/annotationlib.rst:375 +#: ../../library/annotationlib.rst:390 msgid "" "If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " -"(Note that :func:`!get_annotations` doesn't catch exceptions; " -"if :func:`eval` raises an exception, it will unwind the stack past " -"the :func:`!get_annotations` call.)" +"(Note that :func:`!get_annotations` doesn't catch exceptions; if :func:" +"`eval` raises an exception, it will unwind the stack past the :func:`!" +"get_annotations` call.)" msgstr "" -#: ../../library/annotationlib.rst:379 +#: ../../library/annotationlib.rst:394 msgid "" "If *eval_str* is false (the default), values of type :class:`!str` are " "unchanged." msgstr "" -#: ../../library/annotationlib.rst:382 +#: ../../library/annotationlib.rst:397 msgid "" "*globals* and *locals* are passed in to :func:`eval`; see the documentation " "for :func:`eval` for more information. If *globals* or *locals* is :const:`!" @@ -570,48 +589,51 @@ msgid "" "contingent on ``type(obj)``:" msgstr "" -#: ../../library/annotationlib.rst:387 +#: ../../library/annotationlib.rst:402 msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." -msgstr "" +msgstr "如果 *obj* 是模組,則 *globals* 預設為 ``obj.__dict__``。" -#: ../../library/annotationlib.rst:388 +#: ../../library/annotationlib.rst:403 msgid "" -"If *obj* is a class, *globals* defaults to " -"``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* " -"class namespace." +"If *obj* is a class, *globals* defaults to ``sys.modules[obj.__module__]." +"__dict__`` and *locals* defaults to the *obj* class namespace." msgstr "" -#: ../../library/annotationlib.rst:391 +#: ../../library/annotationlib.rst:406 msgid "" "If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " -"`, although if *obj* is a wrapped function " -"(using :func:`functools.update_wrapper`) or a :class:`functools.partial` " -"object, it is unwrapped until a non-wrapped function is found." +"`, although if *obj* is a wrapped function (using :" +"func:`functools.update_wrapper`) or a :class:`functools.partial` object, it " +"is unwrapped until a non-wrapped function is found." msgstr "" -#: ../../library/annotationlib.rst:397 +#: ../../library/annotationlib.rst:412 msgid "" "Calling :func:`!get_annotations` is best practice for accessing the " "annotations dict of any object. See :ref:`annotations-howto` for more " "information on annotations best practices." msgstr "" -#: ../../library/annotationlib.rst:401 +#: ../../library/annotationlib.rst:416 msgid "" ">>> def f(a: int, b: str) -> float:\n" "... pass\n" ">>> get_annotations(f)\n" "{'a': , 'b': , 'return': }" msgstr "" +">>> def f(a: int, b: str) -> float:\n" +"... pass\n" +">>> get_annotations(f)\n" +"{'a': , 'b': , 'return': }" -#: ../../library/annotationlib.rst:412 +#: ../../library/annotationlib.rst:427 msgid "" -"Convert an arbitrary Python value to a format suitable for use by " -"the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, " -"but has special handling for some objects, such as type objects." +"Convert an arbitrary Python value to a format suitable for use by the :attr:" +"`~Format.STRING` format. This calls :func:`repr` for most objects, but has " +"special handling for some objects, such as type objects." msgstr "" -#: ../../library/annotationlib.rst:416 +#: ../../library/annotationlib.rst:431 msgid "" "This is meant as a helper for user-provided annotate functions that support " "the :attr:`~Format.STRING` format but do not have access to the code " @@ -620,15 +642,15 @@ msgid "" "commonly encountered in annotations." msgstr "" -#: ../../library/annotationlib.rst:426 +#: ../../library/annotationlib.rst:441 msgid "Recipes" msgstr "" -#: ../../library/annotationlib.rst:431 +#: ../../library/annotationlib.rst:446 msgid "Using annotations in a metaclass" msgstr "" -#: ../../library/annotationlib.rst:433 +#: ../../library/annotationlib.rst:448 msgid "" "A :ref:`metaclass ` may want to inspect or even modify the " "annotations in a class body during class creation. Doing so requires " @@ -642,21 +664,20 @@ msgid "" "names that cannot yet be resolved when the class is created." msgstr "" -#: ../../library/annotationlib.rst:444 +#: ../../library/annotationlib.rst:459 msgid "" "To modify the annotations, it is best to create a wrapper annotate function " "that calls the original annotate function, makes any necessary adjustments, " "and returns the result." msgstr "" -#: ../../library/annotationlib.rst:448 +#: ../../library/annotationlib.rst:463 msgid "" -"Below is an example of a metaclass that filters out " -"all :class:`typing.ClassVar` annotations from the class and puts them in a " -"separate attribute:" +"Below is an example of a metaclass that filters out all :class:`typing." +"ClassVar` annotations from the class and puts them in a separate attribute:" msgstr "" -#: ../../library/annotationlib.rst:451 +#: ../../library/annotationlib.rst:466 msgid "" "import annotationlib\n" "import typing\n" @@ -707,25 +728,25 @@ msgid "" " return typ" msgstr "" -#: ../../library/annotationlib.rst:499 +#: ../../library/annotationlib.rst:514 msgid "Limitations of the ``STRING`` format" -msgstr "" +msgstr "``STRING`` 格式的限制" -#: ../../library/annotationlib.rst:501 +#: ../../library/annotationlib.rst:516 msgid "" "The :attr:`~Format.STRING` format is meant to approximate the source code of " "the annotation, but the implementation strategy used means that it is not " "always possible to recover the exact source code." msgstr "" -#: ../../library/annotationlib.rst:505 +#: ../../library/annotationlib.rst:520 msgid "" "First, the stringifier of course cannot recover any information that is not " "present in the compiled code, including comments, whitespace, " "parenthesization, and operations that get simplified by the compiler." msgstr "" -#: ../../library/annotationlib.rst:509 +#: ../../library/annotationlib.rst:524 msgid "" "Second, the stringifier can intercept almost all operations that involve " "names looked up in some scope, but it cannot intercept operations that " @@ -735,23 +756,29 @@ msgid "" "access to any globals or builtins. For example:" msgstr "" -#: ../../library/annotationlib.rst:515 +#: ../../library/annotationlib.rst:530 msgid "" -">>> def f(x: (1).__class__.__base__.__subclasses__()" -"[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" +">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__." +"__builtins__[\"print\"](\"Hello world\")): pass\n" "...\n" ">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" "Hello world\n" "{'x': 'None'}" msgstr "" +">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__." +"__builtins__[\"print\"](\"Hello world\")): pass\n" +"...\n" +">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" +"Hello world\n" +"{'x': 'None'}" -#: ../../library/annotationlib.rst:524 +#: ../../library/annotationlib.rst:539 msgid "" "This particular example works as of the time of writing, but it relies on " "implementation details and is not guaranteed to work in the future." msgstr "" -#: ../../library/annotationlib.rst:527 +#: ../../library/annotationlib.rst:542 msgid "" "Among the different kinds of expressions that exist in Python, as " "represented by the :mod:`ast` module, some expressions are supported, " @@ -760,183 +787,184 @@ msgid "" "output or an error." msgstr "" -#: ../../library/annotationlib.rst:532 +#: ../../library/annotationlib.rst:547 msgid "The following are supported (sometimes with caveats):" msgstr "" -#: ../../library/annotationlib.rst:534 +#: ../../library/annotationlib.rst:549 msgid ":class:`ast.BinOp`" -msgstr "" +msgstr ":class:`ast.BinOp`" -#: ../../library/annotationlib.rst:535 +#: ../../library/annotationlib.rst:550 msgid ":class:`ast.UnaryOp`" -msgstr "" +msgstr ":class:`ast.UnaryOp`" -#: ../../library/annotationlib.rst:537 +#: ../../library/annotationlib.rst:552 msgid "" -":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), " -"and :class:`ast.USub` (``-``) are supported" +":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), and :class:`ast." +"USub` (``-``) are supported" msgstr "" +":class:`ast.Invert` (``~``)、:class:`ast.UAdd` (``+``) 和 :class:`ast.USub` (``-``) 有被支援" -#: ../../library/annotationlib.rst:538 +#: ../../library/annotationlib.rst:553 msgid ":class:`ast.Not` (``not``) is not supported" -msgstr "" +msgstr ":class:`ast.Not` (``not``) 並不被支援" -#: ../../library/annotationlib.rst:540 +#: ../../library/annotationlib.rst:555 msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" -msgstr "" +msgstr ":class:`ast.Dict`\\ (除了使用 ``**`` 解包的情況)" -#: ../../library/annotationlib.rst:541 +#: ../../library/annotationlib.rst:556 msgid ":class:`ast.Set`" -msgstr "" +msgstr ":class:`ast.Set`" -#: ../../library/annotationlib.rst:542 +#: ../../library/annotationlib.rst:557 msgid ":class:`ast.Compare`" -msgstr "" +msgstr ":class:`ast.Compare`" -#: ../../library/annotationlib.rst:544 +#: ../../library/annotationlib.rst:559 msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" -msgstr "" +msgstr ":class:`ast.Eq` 和 :class:`ast.NotEq` 有被支援" -#: ../../library/annotationlib.rst:545 +#: ../../library/annotationlib.rst:560 msgid "" ":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " "supported, but the operand may be flipped" msgstr "" -#: ../../library/annotationlib.rst:546 +#: ../../library/annotationlib.rst:561 msgid "" ":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " "are not supported" msgstr "" -#: ../../library/annotationlib.rst:548 +#: ../../library/annotationlib.rst:563 msgid ":class:`ast.Call` (except when using ``**`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:549 +#: ../../library/annotationlib.rst:564 msgid "" ":class:`ast.Constant` (though not the exact representation of the constant; " "for example, escape sequences in strings are lost; hexadecimal numbers are " "converted to decimal)" msgstr "" -#: ../../library/annotationlib.rst:551 +#: ../../library/annotationlib.rst:566 msgid ":class:`ast.Attribute` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:552 +#: ../../library/annotationlib.rst:567 msgid ":class:`ast.Subscript` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:553 +#: ../../library/annotationlib.rst:568 msgid ":class:`ast.Starred` (``*`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:554 +#: ../../library/annotationlib.rst:569 msgid ":class:`ast.Name`" -msgstr "" +msgstr ":class:`ast.Name`" -#: ../../library/annotationlib.rst:555 +#: ../../library/annotationlib.rst:570 msgid ":class:`ast.List`" -msgstr "" +msgstr ":class:`ast.List`" -#: ../../library/annotationlib.rst:556 +#: ../../library/annotationlib.rst:571 msgid ":class:`ast.Tuple`" -msgstr "" +msgstr ":class:`ast.Tuple`" -#: ../../library/annotationlib.rst:557 +#: ../../library/annotationlib.rst:572 msgid ":class:`ast.Slice`" -msgstr "" +msgstr ":class:`ast.Slice`" -#: ../../library/annotationlib.rst:559 +#: ../../library/annotationlib.rst:574 msgid "" "The following are unsupported, but throw an informative error when " "encountered by the stringifier:" msgstr "" -#: ../../library/annotationlib.rst:562 +#: ../../library/annotationlib.rst:577 msgid "" ":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " "specifiers like ``!r`` are used)" msgstr "" -#: ../../library/annotationlib.rst:564 +#: ../../library/annotationlib.rst:579 msgid ":class:`ast.JoinedStr` (f-strings)" -msgstr "" +msgstr ":class:`ast.JoinedStr`\\ (f 字串)" -#: ../../library/annotationlib.rst:566 +#: ../../library/annotationlib.rst:581 msgid "The following are unsupported and result in incorrect output:" -msgstr "" +msgstr "以下是不支援的,並且會導致不正確的輸出:" -#: ../../library/annotationlib.rst:568 +#: ../../library/annotationlib.rst:583 msgid ":class:`ast.BoolOp` (``and`` and ``or``)" -msgstr "" +msgstr ":class:`ast.BoolOp`\\ (``and`` 和 ``or``)" -#: ../../library/annotationlib.rst:569 +#: ../../library/annotationlib.rst:584 msgid ":class:`ast.IfExp`" -msgstr "" +msgstr ":class:`ast.IfExp`" -#: ../../library/annotationlib.rst:570 +#: ../../library/annotationlib.rst:585 msgid ":class:`ast.Lambda`" -msgstr "" +msgstr ":class:`ast.Lambda`" -#: ../../library/annotationlib.rst:571 +#: ../../library/annotationlib.rst:586 msgid ":class:`ast.ListComp`" -msgstr "" +msgstr ":class:`ast.ListComp`" -#: ../../library/annotationlib.rst:572 +#: ../../library/annotationlib.rst:587 msgid ":class:`ast.SetComp`" -msgstr "" +msgstr ":class:`ast.SetComp`" -#: ../../library/annotationlib.rst:573 +#: ../../library/annotationlib.rst:588 msgid ":class:`ast.DictComp`" -msgstr "" +msgstr ":class:`ast.DictComp`" -#: ../../library/annotationlib.rst:574 +#: ../../library/annotationlib.rst:589 msgid ":class:`ast.GeneratorExp`" -msgstr "" +msgstr ":class:`ast.GeneratorExp`" -#: ../../library/annotationlib.rst:576 +#: ../../library/annotationlib.rst:591 msgid "" "The following are disallowed in annotation scopes and therefore not relevant:" msgstr "" -#: ../../library/annotationlib.rst:578 +#: ../../library/annotationlib.rst:593 msgid ":class:`ast.NamedExpr` (``:=``)" -msgstr "" +msgstr ":class:`ast.NamedExpr` (``:=``)" -#: ../../library/annotationlib.rst:579 +#: ../../library/annotationlib.rst:594 msgid ":class:`ast.Await`" -msgstr "" +msgstr ":class:`ast.Await`" -#: ../../library/annotationlib.rst:580 +#: ../../library/annotationlib.rst:595 msgid ":class:`ast.Yield`" -msgstr "" +msgstr ":class:`ast.Yield`" -#: ../../library/annotationlib.rst:581 +#: ../../library/annotationlib.rst:596 msgid ":class:`ast.YieldFrom`" -msgstr "" +msgstr ":class:`ast.YieldFrom`" -#: ../../library/annotationlib.rst:585 +#: ../../library/annotationlib.rst:600 msgid "Limitations of the ``FORWARDREF`` format" -msgstr "" +msgstr "``FORWARDREF`` 格式的限制" -#: ../../library/annotationlib.rst:587 +#: ../../library/annotationlib.rst:602 msgid "" "The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " -"possible, with anything that cannot be resolved replaced " -"with :class:`ForwardRef` objects. It is affected by broadly the same " -"Limitations as the :attr:`~Format.STRING` format: annotations that perform " -"operations on literals or that use unsupported expression types may raise " -"exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." +"possible, with anything that cannot be resolved replaced with :class:" +"`ForwardRef` objects. It is affected by broadly the same Limitations as the :" +"attr:`~Format.STRING` format: annotations that perform operations on " +"literals or that use unsupported expression types may raise exceptions when " +"evaluated using the :attr:`~Format.FORWARDREF` format." msgstr "" -#: ../../library/annotationlib.rst:594 +#: ../../library/annotationlib.rst:609 msgid "Below are a few examples of the behavior with unsupported expressions:" msgstr "" -#: ../../library/annotationlib.rst:596 +#: ../../library/annotationlib.rst:611 msgid "" ">>> from annotationlib import get_annotations, Format\n" ">>> def zerodiv(x: 1 / 0): ...\n" @@ -952,25 +980,38 @@ msgid "" ">>> get_annotations(ifexp, format=Format.STRING)\n" "{'x': '1'}" msgstr "" +">>> from annotationlib import get_annotations, Format\n" +">>> def zerodiv(x: 1 / 0): ...\n" +">>> get_annotations(zerodiv, format=Format.STRING)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> get_annotations(zerodiv, format=Format.FORWARDREF)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def ifexp(x: 1 if y else 0): ...\n" +">>> get_annotations(ifexp, format=Format.STRING)\n" +"{'x': '1'}" -#: ../../library/annotationlib.rst:615 +#: ../../library/annotationlib.rst:630 msgid "Security implications of introspecting annotations" msgstr "" -#: ../../library/annotationlib.rst:617 +#: ../../library/annotationlib.rst:632 msgid "" "Much of the functionality in this module involves executing code related to " -"annotations, which can then do arbitrary things. For " -"example, :func:`get_annotations` may call an arbitrary :term:`annotate " -"function`, and :meth:`ForwardRef.evaluate` may call :func:`eval` on an " -"arbitrary string. Code contained in an annotation might make arbitrary " -"system calls, enter an infinite loop, or perform any other operation. This " -"is also true for any access of the :attr:`~object.__annotations__` " -"attribute, and for various functions in the :mod:`typing` module that work " -"with annotations, such as :func:`typing.get_type_hints`." +"annotations, which can then do arbitrary things. For example, :func:" +"`get_annotations` may call an arbitrary :term:`annotate function`, and :meth:" +"`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code " +"contained in an annotation might make arbitrary system calls, enter an " +"infinite loop, or perform any other operation. This is also true for any " +"access of the :attr:`~object.__annotations__` attribute, and for various " +"functions in the :mod:`typing` module that work with annotations, such as :" +"func:`typing.get_type_hints`." msgstr "" -#: ../../library/annotationlib.rst:626 +#: ../../library/annotationlib.rst:641 msgid "" "Any security issue arising from this also applies immediately after " "importing code that may contain untrusted annotations: importing code can " diff --git a/library/argparse.po b/library/argparse.po index 41fc0df320..075bef6951 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -542,6 +542,26 @@ msgid "" "words\n" "will be wrapped across a couple lines" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... description='''this description\n" +"... was indented weird\n" +"... but that is okay''',\n" +"... epilog='''\n" +"... likewise for this epilog whose whitespace will\n" +"... be cleaned up and whose words will be wrapped\n" +"... across a couple lines''')\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"this description was indented weird but that is okay\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"likewise for this epilog whose whitespace will be cleaned up and whose " +"words\n" +"will be wrapped across a couple lines" #: ../../library/argparse.rst:330 msgid "" @@ -1053,6 +1073,14 @@ msgid "" "tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " "'sum'? (choose from 'sum', 'max')" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +" suggest_on_error=True)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--action', 'sumn', 1, 2, 3])\n" +"tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " +"'sum'? (choose from 'sum', 'max')" #: ../../library/argparse.rst:615 msgid "" @@ -1067,6 +1095,8 @@ msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" ">>> parser.suggest_on_error = True" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" +">>> parser.suggest_on_error = True" #: ../../library/argparse.rst:627 msgid "color" @@ -1090,6 +1120,12 @@ msgid "" "... help='an integer for the accumulator')\n" ">>> parser.parse_args(['--help'])" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +"... color=False)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--help'])" #: ../../library/argparse.rst:646 msgid "The add_argument() method" @@ -1405,6 +1441,10 @@ msgid "" ">>> parser.parse_args(['-vvv'])\n" "Namespace(verbose=3)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" +">>> parser.parse_args(['-vvv'])\n" +"Namespace(verbose=3)" #: ../../library/argparse.rst:823 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." @@ -1487,6 +1527,23 @@ msgid "" ">>> args\n" "Namespace(bar='1', foo='2')" msgstr "" +">>> class FooAction(argparse.Action):\n" +"... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" +"... if nargs is not None:\n" +"... raise ValueError(\"nargs not allowed\")\n" +"... super().__init__(option_strings, dest, **kwargs)\n" +"... def __call__(self, parser, namespace, values, option_string=None):\n" +"... print('%r %r %r' % (namespace, values, option_string))\n" +"... setattr(namespace, self.dest, values)\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=FooAction)\n" +">>> parser.add_argument('bar', action=FooAction)\n" +">>> args = parser.parse_args('1 --foo 2'.split())\n" +"Namespace(bar=None, foo=None) '1' None\n" +"Namespace(bar='1', foo=None) '2' '--foo'\n" +">>> args\n" +"Namespace(bar='1', foo='2')" #: ../../library/argparse.rst:871 msgid "For more details, see :class:`Action`." @@ -3757,6 +3814,18 @@ msgid "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" +">>> parser.add_argument('--foo', type='hexadecimal integer')\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" +">>> parser.parse_args(['--foo', '0xFA'])\n" +"Namespace(foo=250)\n" +">>> parser.parse_args(['--foo', '1.2'])\n" +"usage: PROG [-h] [--foo FOO]\n" +"PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" #: ../../library/argparse.rst:2267 msgid "Exceptions" diff --git a/library/ast.po b/library/ast.po index 7c52be3473..013311dd14 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-24 00:14+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-" @@ -38,12 +38,12 @@ msgstr "" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by " -"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " -"function, or using the :func:`parse` helper provided in this module. The " -"result will be a tree of objects whose classes all inherit " -"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " -"Python code object using the built-in :func:`compile` function." +"An abstract syntax tree can be generated by passing :data:`ast." +"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " +"the :func:`parse` helper provided in this module. The result will be a tree " +"of objects whose classes all inherit from :class:`ast.AST`. An abstract " +"syntax tree can be compiled into a Python code object using the built-in :" +"func:`compile` function." msgstr "" "要生成抽象語法樹,可以透過將 :data:`ast.PyCF_ONLY_AST` 作為旗標傳遞給內建函" "式 :func:`compile` 或使用此模組所提供的 :func:`parse` 輔助函式。結果將會是一" @@ -242,13 +242,13 @@ msgstr "節點 (Node) 類別" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is " -"reproduced :ref:`above `. They are defined in the :mod:`!" -"_ast` C module and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" +"`above `. They are defined in the :mod:`!_ast` C module " +"and re-exported in :mod:`ast`." msgstr "" -"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/" -"Python.asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義" -"於 :mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" +"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/Python." +"asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義於 :" +"mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" #: ../../library/ast.rst:51 msgid "" @@ -260,11 +260,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " -"或 :class:`ast.expr`)。此外,也為每個右側的建構函式 (constructor) 定義了" -"一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" -"自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" -"別是抽象的:僅有特定建構函式節點的實例會被建立。" +"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` 或 :class:" +"`ast.expr`)。此外,也為每個右側的建構函式 (constructor) 定義了一個類別;這些" +"類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承自 :class:`ast.expr`。對" +"於具有替代方案(即為「和 (sums)」)的生產規則,左側類別是抽象的:僅有特定建構" +"函式節點的實例會被建立。" #: ../../library/ast.rst:64 msgid "" @@ -278,8 +278,8 @@ msgid "" "the type as defined in the grammar. For example, :class:`ast.BinOp` " "instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例" -"如,:class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" +"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例如,:" +"class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" #: ../../library/ast.rst:71 msgid "" @@ -290,16 +290,16 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" "如果這些屬性在文法中被標記為可選(使用問號),則該值可能為 ``None``。如果屬性" -"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使" -"用 :func:`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" +"`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" #: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" -"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也" -"在 :attr:`_fields` 中列出)對映到其型別的字典。" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" +"`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -313,22 +313,21 @@ msgstr "" #: ../../library/ast.rst:94 msgid "" -"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " -"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " -"and :attr:`end_col_offset` attributes. The :attr:`lineno` " -"and :attr:`end_lineno` are the first and last line numbers of source text " -"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " -"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " -"first and last tokens that generated the node. The UTF-8 offset is recorded " -"because the parser uses UTF-8 internally." -msgstr "" -":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具" -"有 :attr:`lineno`、:attr:`col_offset`、:attr:`end_lineno` " -"和 :attr:`end_col_offset` 屬性。:attr:`lineno` 和 :attr:`end_lineno` 是原始文" -"本跨度 (source text span) 的第一個和最後一個列號(1-indexed,因此第一列號是 " -"1)以及 :attr:`col_offset` 和 :attr:`end_col_offset` 是生成節點的第一個和最後" -"一個標記對應的 UTF-8 位元組偏移量。會記錄 UTF-8 偏移量是因為剖析器 (parser) " -"內部使用 UTF-8。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" +"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " +"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " +"last line numbers of source text span (1-indexed so the first line is line " +"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " +"corresponding UTF-8 byte offsets of the first and last tokens that generated " +"the node. The UTF-8 offset is recorded because the parser uses UTF-8 " +"internally." +msgstr "" +":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具有 :attr:`lineno`、:" +"attr:`col_offset`、:attr:`end_lineno` 和 :attr:`end_col_offset` 屬性。:attr:" +"`lineno` 和 :attr:`end_lineno` 是原始文本跨度 (source text span) 的第一個和最" +"後一個列號(1-indexed,因此第一列號是 1)以及 :attr:`col_offset` 和 :attr:" +"`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" +"會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" #: ../../library/ast.rst:103 msgid "" @@ -380,15 +379,15 @@ msgid "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, " -"a :exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, a :" +"exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" "如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," -"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設" -"為 :class:`Load() `。如果省略任何其他欄位,則會引" -"發 :exc:`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這" -"種情況會引發錯誤。" +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" +"class:`Load() `。如果省略任何其他欄位,則會引發 :exc:" +"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" +"引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -408,10 +407,10 @@ msgstr "" #: ../../library/ast.rst:144 msgid "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" -"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still " -"available, but they will be removed in future Python releases. In the " -"meantime, instantiating them will return an instance of a different class." +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" +"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " +"but they will be removed in future Python releases. In the meantime, " +"instantiating them will return an instance of a different class." msgstr "" "舊的類別 :class:`!ast.Num`、:class:`!ast.Str`、:class:`!ast.Bytes`、:class:`!" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " @@ -441,9 +440,8 @@ msgstr "" #: ../../library/ast.rst:165 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its " -"contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." msgstr "" "這裡顯示的特定節點類別的描述最初是從出色的 `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" @@ -458,8 +456,8 @@ msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。" -"由 :func:`ast.parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" +"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." +"parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:181 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." @@ -527,8 +525,8 @@ msgstr "" #: ../../library/ast.rst:217 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` " -"的 :class:`list`。" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" +"`list`。" #: ../../library/ast.rst:219 msgid "" @@ -621,14 +619,14 @@ msgstr "文本 (Literals)" msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " -"instances " -"of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, " -"and :class:`bool`, and the constants :data:`None` and :data:`Ellipsis`." +"instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :" +"class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:" +"`Ellipsis`." msgstr "" "一個常數值。``Constant`` 文本的 ``value`` 屬性包含它所代表的 Python 物件。表" -"示的值可以" -"是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:class:`complex` " -"和 :class:`bool` 的實例,以及常數 :data:`None` 和 :data:`Ellipsis`。" +"示的值可以是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:" +"class:`complex` 和 :class:`bool` 的實例,以及常數 :data:`None` 和 :data:" +"`Ellipsis`。" #: ../../library/ast.rst:284 msgid "" @@ -646,7 +644,7 @@ msgid "" "function call)." msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" -#: ../../library/ast.rst:290 ../../library/ast.rst:367 +#: ../../library/ast.rst:290 ../../library/ast.rst:372 msgid "``conversion`` is an integer:" msgstr "``conversion`` 是一個整數:" @@ -677,8 +675,8 @@ msgstr "" #: ../../library/ast.rst:304 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` " -"and :class:`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` and :class:" +"`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" @@ -726,9 +724,9 @@ msgstr "" #: ../../library/ast.rst:333 msgid "" -"Node representing a template string literal, comprising a series " -"of :class:`Interpolation` and :class:`Constant` nodes. These nodes may be " -"any order, and do not need to be interleaved." +"Node representing a template string literal, comprising a series of :class:" +"`Interpolation` and :class:`Constant` nodes. These nodes may be any order, " +"and do not need to be interleaved." msgstr "" #: ../../library/ast.rst:337 @@ -778,34 +776,43 @@ msgstr "" msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call). This has the same meaning as ``FormattedValue.value``." -msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。這和 ``FormattedValue.value`` 的意思相同。" +msgstr "" +"``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。這和 " +"``FormattedValue.value`` 的意思相同。" #: ../../library/ast.rst:366 msgid "" "``str`` is a constant containing the text of the interpolation expression." msgstr "" -#: ../../library/ast.rst:369 +#: ../../library/ast.rst:368 +msgid "" +"If ``str`` is set to ``None``, then ``value`` is used to generate code when " +"calling :func:`ast.unparse`. This no longer guarantees that the generated " +"code is identical to the original and is intended for code generation." +msgstr "" + +#: ../../library/ast.rst:374 msgid "-1: no conversion" msgstr "-1:無規範" -#: ../../library/ast.rst:370 +#: ../../library/ast.rst:375 msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" msgstr "97 (``ord('a')``):``!a`` :func:`ASCII ` 轉換" -#: ../../library/ast.rst:371 +#: ../../library/ast.rst:376 msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" msgstr "114 (``ord('r')``):``!r`` :func:`repr` 轉換" -#: ../../library/ast.rst:372 +#: ../../library/ast.rst:377 msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" msgstr "115 (``ord('s')``):``!s`` :func:`string ` 轉換" -#: ../../library/ast.rst:374 +#: ../../library/ast.rst:379 msgid "This has the same meaning as ``FormattedValue.conversion``." msgstr "這與 ``FormattedValue.conversion`` 的意思相同。" -#: ../../library/ast.rst:375 +#: ../../library/ast.rst:380 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -816,16 +823,16 @@ msgstr "" "為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。這與 " "``FormattedValue.format_spec`` 的意思相同。" -#: ../../library/ast.rst:384 +#: ../../library/ast.rst:389 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 " -"``(x,y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" +"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," +"y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" -#: ../../library/ast.rst:388 +#: ../../library/ast.rst:393 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -861,11 +868,11 @@ msgstr "" " Constant(value=3)],\n" " ctx=Load()))" -#: ../../library/ast.rst:410 +#: ../../library/ast.rst:415 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "一個集合。``elts`` 保存表示集合之元素的節點串列。" -#: ../../library/ast.rst:412 +#: ../../library/ast.rst:417 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -883,7 +890,7 @@ msgstr "" " Constant(value=2),\n" " Constant(value=3)]))" -#: ../../library/ast.rst:425 +#: ../../library/ast.rst:430 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " @@ -893,7 +900,7 @@ msgstr "" "節點串列(為呼叫 :code:`dictionary.keys()` 和 :code:`dictionary.values()` 時" "將回傳的內容)。" -#: ../../library/ast.rst:429 +#: ../../library/ast.rst:434 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " @@ -902,7 +909,7 @@ msgstr "" "當使用字典文本進行字典解包 (unpack) 時,要擴充的運算式位於 ``values`` 串列" "中,在 ``keys`` 中的相應位置有一個 ``None``。" -#: ../../library/ast.rst:433 +#: ../../library/ast.rst:438 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -924,17 +931,17 @@ msgstr "" " Constant(value=1),\n" " Name(id='d', ctx=Load())]))" -#: ../../library/ast.rst:447 +#: ../../library/ast.rst:452 msgid "Variables" msgstr "變數" -#: ../../library/ast.rst:451 +#: ../../library/ast.rst:456 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "一個變數名稱。``id`` 將名稱以字串形式保存,且 ``ctx`` 是以下型別之一。" -#: ../../library/ast.rst:459 +#: ../../library/ast.rst:464 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " @@ -943,7 +950,7 @@ msgstr "" "變數參照可用於載入變數的值、為其分配新值或刪除它。變數參照被賦予情境 " "(context) 來區分這些情況。" -#: ../../library/ast.rst:463 +#: ../../library/ast.rst:468 msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -987,16 +994,16 @@ msgstr "" " targets=[\n" " Name(id='a', ctx=Del())])])" -#: ../../library/ast.rst:489 +#: ../../library/ast.rst:494 msgid "" -"A ``*var`` variable reference. ``value`` holds the variable, typically " -"a :class:`Name` node. This type must be used when building a :class:`Call` " -"node with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically a :" +"class:`Name` node. This type must be used when building a :class:`Call` node " +"with ``*args``." msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" -#: ../../library/ast.rst:493 +#: ../../library/ast.rst:498 msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -1026,24 +1033,24 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='it', ctx=Load()))])" -#: ../../library/ast.rst:513 +#: ../../library/ast.rst:518 msgid "Expressions" msgstr "運算式" -#: ../../library/ast.rst:517 +#: ../../library/ast.rst:522 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, " -"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " -"or :class:`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, a :class:" +"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" +"`YieldFrom` node." msgstr "" "當運算式(例如函式呼叫)本身作為陳述式出現且未使用或儲存其回傳值時,它將被包" -"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節" -"點::class:`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` " -"或 :class:`YieldFrom`" +"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節點::class:" +"`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" +"`YieldFrom`" -#: ../../library/ast.rst:522 +#: ../../library/ast.rst:527 msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -1061,14 +1068,14 @@ msgstr "" " op=USub(),\n" " operand=Name(id='a', ctx=Load())))])" -#: ../../library/ast.rst:535 +#: ../../library/ast.rst:540 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" "一元運算 (unary operation)。``op`` 是運算子,``operand`` 是任何運算式節點。" -#: ../../library/ast.rst:544 +#: ../../library/ast.rst:549 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." @@ -1076,7 +1083,7 @@ msgstr "" "一元運算子標記。 :class:`Not` 是 ``not`` 關鍵字、:class:`Invert` 是 ``~`` 運" "算子。" -#: ../../library/ast.rst:547 +#: ../../library/ast.rst:552 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -1090,7 +1097,7 @@ msgstr "" " op=Not(),\n" " operand=Name(id='x', ctx=Load())))" -#: ../../library/ast.rst:558 +#: ../../library/ast.rst:563 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." @@ -1098,7 +1105,7 @@ msgstr "" "二元運算 (binary operation)(如加法或除法)。 ``op`` 是運算子、``left`` 和 " "``right`` 是任意運算式節點。" -#: ../../library/ast.rst:561 +#: ../../library/ast.rst:566 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1114,11 +1121,11 @@ msgstr "" " op=Add(),\n" " right=Name(id='y', ctx=Load())))" -#: ../../library/ast.rst:585 +#: ../../library/ast.rst:590 msgid "Binary operator tokens." msgstr "二元運算子 token。" -#: ../../library/ast.rst:590 +#: ../../library/ast.rst:595 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -1126,14 +1133,14 @@ msgid "" "values." msgstr "" "布林運算 'or' 或 'and'。``op`` 是 :class:`Or` 或 :class:`And`。``values`` 是" -"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``)會被折疊為具" -"有多個值的一個節點。" +"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``)會被折疊為具有" +"多個值的一個節點。" -#: ../../library/ast.rst:595 +#: ../../library/ast.rst:600 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "這不包括 ``not``,它是一個 :class:`UnaryOp`。" -#: ../../library/ast.rst:597 +#: ../../library/ast.rst:602 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1151,11 +1158,11 @@ msgstr "" " Name(id='x', ctx=Load()),\n" " Name(id='y', ctx=Load())]))" -#: ../../library/ast.rst:611 +#: ../../library/ast.rst:616 msgid "Boolean operator tokens." msgstr "布林運算子 token。" -#: ../../library/ast.rst:616 +#: ../../library/ast.rst:621 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " @@ -1164,7 +1171,7 @@ msgstr "" "兩個或多個值的比較。``left`` 是比較中的第一個值、``ops`` 是運算子串列、" "``comparators`` 是要比較的第一個元素之後值的串列。" -#: ../../library/ast.rst:620 +#: ../../library/ast.rst:625 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -1188,36 +1195,36 @@ msgstr "" " Name(id='a', ctx=Load()),\n" " Constant(value=10)]))" -#: ../../library/ast.rst:645 +#: ../../library/ast.rst:650 msgid "Comparison operator tokens." msgstr "比較運算子 token。" -#: ../../library/ast.rst:650 +#: ../../library/ast.rst:655 msgid "" -"A function call. ``func`` is the function, which will often be " -"a :class:`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be a :class:" +"`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` " -"或 :class:`Attribute` 物件。而在引數中:" +"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" +"`Attribute` 物件。而在引數中:" -#: ../../library/ast.rst:653 +#: ../../library/ast.rst:658 msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` 保存按位置傳遞的引數串列。" -#: ../../library/ast.rst:654 +#: ../../library/ast.rst:659 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" -#: ../../library/ast.rst:657 +#: ../../library/ast.rst:662 msgid "" "The ``args`` and ``keywords`` arguments are optional and default to empty " "lists." msgstr "``args`` 和 ``keywords`` 引數是可選的,預設為空串列。" -#: ../../library/ast.rst:659 +#: ../../library/ast.rst:664 msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " "indent=4))\n" @@ -1253,7 +1260,7 @@ msgstr "" " keyword(\n" " value=Name(id='e', ctx=Load()))]))" -#: ../../library/ast.rst:680 +#: ../../library/ast.rst:685 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." @@ -1261,7 +1268,7 @@ msgstr "" "函式呼叫或類別定義的關鍵字引數。``arg`` 是參數名稱的原始字串,``value`` 是要" "傳入的節點。" -#: ../../library/ast.rst:686 +#: ../../library/ast.rst:691 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." @@ -1269,7 +1276,7 @@ msgstr "" "像是 ``a if b else c`` 之類的運算式。每個欄位都保存一個節點,因此在以下範例" "中,所有三個都是 :class:`Name` 節點。" -#: ../../library/ast.rst:689 +#: ../../library/ast.rst:694 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -1285,18 +1292,18 @@ msgstr "" " body=Name(id='a', ctx=Load()),\n" " orelse=Name(id='c', ctx=Load())))" -#: ../../library/ast.rst:701 +#: ../../library/ast.rst:706 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " -"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " -"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " -"how the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" +"`Name`. ``attr`` is a bare string giving the name of the attribute, and " +"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " +"the attribute is acted on." msgstr "" "屬性的存取,例如 ``d.keys``。``value`` 是一個節點,通常是一個 :class:`Name`。" -"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能" -"是 :class:`Load`、:class:`Store` 或 :class:`Del`。" +"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" +"`Load`、:class:`Store` 或 :class:`Del`。" -#: ../../library/ast.rst:706 +#: ../../library/ast.rst:711 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -1312,18 +1319,18 @@ msgstr "" " attr='colour',\n" " ctx=Load()))" -#: ../../library/ast.rst:718 +#: ../../library/ast.rst:723 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to " -"the :class:`Assign` node in which the first argument can be multiple nodes, " -"in this case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to the :class:" +"`Assign` node in which the first argument can be multiple nodes, in this " +"case both ``target`` and ``value`` must be single nodes." msgstr "" "一個附名運算式 (named expression)。該 AST 節點由賦值運算式運算子(也稱為海象" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" "下 ``target`` 和 ``value`` 都必須是單個節點。" -#: ../../library/ast.rst:723 +#: ../../library/ast.rst:728 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1337,24 +1344,23 @@ msgstr "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" -#: ../../library/ast.rst:734 +#: ../../library/ast.rst:739 msgid "Subscripting" msgstr "下標 (Subscripting)" -#: ../../library/ast.rst:738 +#: ../../library/ast.rst:743 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be " -"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " -"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " -"performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" +"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" +"`Store` or :class:`Del` according to the action performed with the subscript." msgstr "" "一個下標,例如 ``l[1]``。``value`` 是下標物件(通常是序列或對映)。``slice`` " "是索引、切片或鍵。它可以是一個 :class:`Tuple` 並包含一個 :class:`Slice`。根據" -"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` " -"或 :class:`Del`。" +"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" +"`Del`。" -#: ../../library/ast.rst:744 +#: ../../library/ast.rst:749 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1382,16 +1388,16 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:762 +#: ../../library/ast.rst:767 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " "or as an element of :class:`Tuple`." msgstr "" -"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``)。只能直接或者或" -"者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" +"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``)。只能直接或者或者" +"作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" -#: ../../library/ast.rst:766 +#: ../../library/ast.rst:771 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1411,11 +1417,11 @@ msgstr "" " upper=Constant(value=2)),\n" " ctx=Load()))" -#: ../../library/ast.rst:779 +#: ../../library/ast.rst:784 msgid "Comprehensions" msgstr "綜合運算式 (comprehensions)" -#: ../../library/ast.rst:786 +#: ../../library/ast.rst:791 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " @@ -1424,11 +1430,11 @@ msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " "``value``)是單個節點,表示各個項目會被求值 (evaluate) 的部分。" -#: ../../library/ast.rst:790 +#: ../../library/ast.rst:795 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" -#: ../../library/ast.rst:792 +#: ../../library/ast.rst:797 msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" @@ -1512,18 +1518,18 @@ msgstr "" " iter=Name(id='numbers', ctx=Load()),\n" " is_async=0)]))" -#: ../../library/ast.rst:838 +#: ../../library/ast.rst:843 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " "``iter`` is the object to iterate over. ``ifs`` is a list of test " "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常" -"是 :class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是" -"測試運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" +"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常是 :" +"class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" +"運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" -#: ../../library/ast.rst:843 +#: ../../library/ast.rst:848 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." @@ -1531,7 +1537,7 @@ msgstr "" "``is_async`` 表示綜合運算式是非同步的(使用 ``async for`` 而不是 ``for`` )。" "該值為整數(0 或 1)。" -#: ../../library/ast.rst:846 +#: ../../library/ast.rst:851 msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1649,17 +1655,17 @@ msgstr "" " iter=Name(id='soc', ctx=Load()),\n" " is_async=1)]))" -#: ../../library/ast.rst:908 +#: ../../library/ast.rst:913 msgid "Statements" msgstr "陳述式" -#: ../../library/ast.rst:912 +#: ../../library/ast.rst:917 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "一個賦值。``targets`` 是節點串列,``value`` 是單個節點。" -#: ../../library/ast.rst:914 +#: ../../library/ast.rst:919 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " @@ -1668,13 +1674,13 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:920 ../../library/ast.rst:1215 -#: ../../library/ast.rst:1409 ../../library/ast.rst:1975 +#: ../../library/ast.rst:925 ../../library/ast.rst:1220 +#: ../../library/ast.rst:1414 ../../library/ast.rst:1980 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" -#: ../../library/ast.rst:922 +#: ../../library/ast.rst:927 msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1718,32 +1724,31 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='c', ctx=Load()))])" -#: ../../library/ast.rst:948 +#: ../../library/ast.rst:953 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " -"``annotation`` is the annotation, such as a :class:`Constant` " -"or :class:`Name` node. ``value`` is a single optional node." +"``annotation`` is the annotation, such as a :class:`Constant` or :class:" +"`Name` node. ``value`` is a single optional node." msgstr "" -"帶有型別註釋的賦值。``target`` 是單個節點,可以" -"是 :class:`Name`、:class:`Attribute` 或 :class:`Subscript`。``annotation`` 是" -"註釋,例如 :class:`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節" -"點。" +"帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" +"`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" +"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" -#: ../../library/ast.rst:953 +#: ../../library/ast.rst:958 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " -"(indicating a \"simple\" target). A \"simple\" target consists solely of " -"a :class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in " -"the :attr:`~object.__annotations__` dictionary of modules and classes." +"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" +"class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in the :attr:" +"`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別" -"的 :attr:`~object.__annotations__` 字典中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." +"__annotations__` 字典中。" -#: ../../library/ast.rst:959 +#: ../../library/ast.rst:964 msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1827,7 +1832,7 @@ msgstr "" " annotation=Name(id='int', ctx=Load()),\n" " simple=0)])" -#: ../../library/ast.rst:1003 +#: ../../library/ast.rst:1008 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -1835,18 +1840,18 @@ msgid "" "value for 1." msgstr "" "增加賦值 (augmented assignment),例如 ``a += 1``。在下面的範例中,``target`` " -"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` " -"是 :class:`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" +"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" +"`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:1008 +#: ../../library/ast.rst:1013 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` " -"或 :class:`List` 類別。" +"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" +"class:`List` 類別。" -#: ../../library/ast.rst:1011 +#: ../../library/ast.rst:1016 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1864,17 +1869,17 @@ msgstr "" " op=Add(),\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:1024 +#: ../../library/ast.rst:1029 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` " -"或 :class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " +"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` 或 :" +"class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:1028 +#: ../../library/ast.rst:1033 msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -1890,7 +1895,7 @@ msgstr "" " exc=Name(id='x', ctx=Load()),\n" " cause=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:1040 +#: ../../library/ast.rst:1045 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -1898,7 +1903,7 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:1043 +#: ../../library/ast.rst:1048 msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -1914,15 +1919,15 @@ msgstr "" " test=Name(id='x', ctx=Load()),\n" " msg=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:1055 +#: ../../library/ast.rst:1060 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such " -"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" +"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例" -"如 :class:`Name`、:class:`Attribute` 或 :class:`Subscript` 節點。" +"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" +"`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1058 +#: ../../library/ast.rst:1063 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1942,11 +1947,11 @@ msgstr "" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" -#: ../../library/ast.rst:1072 +#: ../../library/ast.rst:1077 msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" -#: ../../library/ast.rst:1074 +#: ../../library/ast.rst:1079 msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -1958,18 +1963,18 @@ msgstr "" " body=[\n" " Pass()])" -#: ../../library/ast.rst:1084 +#: ../../library/ast.rst:1089 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " -"statement. ``name`` is the name of the alias, ``type_params`` is a list " -"of :ref:`type parameters `, and ``value`` is the value of " -"the type alias." +"statement. ``name`` is the name of the alias, ``type_params`` is a list of :" +"ref:`type parameters `, and ``value`` is the value of the " +"type alias." msgstr "" "透過 :keyword:`type` 陳述式建立的\\ :ref:`型別別名 (type alias) `。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1089 +#: ../../library/ast.rst:1094 msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -1985,21 +1990,21 @@ msgstr "" " name=Name(id='Alias', ctx=Store()),\n" " value=Name(id='int', ctx=Load()))])" -#: ../../library/ast.rst:1100 +#: ../../library/ast.rst:1105 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1104 +#: ../../library/ast.rst:1109 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1108 +#: ../../library/ast.rst:1113 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1110 +#: ../../library/ast.rst:1115 msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -2019,7 +2024,7 @@ msgstr "" " alias(name='y'),\n" " alias(name='z')])])" -#: ../../library/ast.rst:1124 +#: ../../library/ast.rst:1129 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -2030,7 +2035,7 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1129 +#: ../../library/ast.rst:1134 msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -2054,7 +2059,7 @@ msgstr "" " alias(name='z')],\n" " level=0)])" -#: ../../library/ast.rst:1145 +#: ../../library/ast.rst:1150 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -2062,7 +2067,7 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1148 +#: ../../library/ast.rst:1153 msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -2084,25 +2089,25 @@ msgstr "" " alias(name='c')],\n" " level=2)])" -#: ../../library/ast.rst:1161 +#: ../../library/ast.rst:1166 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1164 +#: ../../library/ast.rst:1169 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1169 +#: ../../library/ast.rst:1174 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as " -"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as a :class:" +"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1172 +#: ../../library/ast.rst:1177 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -2111,7 +2116,7 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1176 +#: ../../library/ast.rst:1181 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -2163,22 +2168,22 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1206 +#: ../../library/ast.rst:1211 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " -"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " -"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " -"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" +"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " +"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" -"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單" -"個 :class:`Name`、:class:`Tuple`、:class:`List`、:class:`Attribute` " -"或 :class:`Subscript` 節點。``iter`` 保存要迴圈跑過的項目,也為單個節點。" -"``body`` 和 ``orelse`` 包含要執行的節點串列。如果迴圈正常完成,則執行 " -"``orelse`` 中的內容,而不是透過 ``break`` 陳述式執行。" +"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單個 :class:`Name`、:" +"class:`Tuple`、:class:`List`、:class:`Attribute` 或 :class:`Subscript` 節點。" +"``iter`` 保存要迴圈跑過的項目,也為單個節點。``body`` 和 ``orelse`` 包含要執" +"行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " +"``break`` 陳述式執行。" -#: ../../library/ast.rst:1217 +#: ../../library/ast.rst:1222 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2216,13 +2221,13 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1240 +#: ../../library/ast.rst:1245 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1243 +#: ../../library/ast.rst:1248 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2258,11 +2263,11 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1266 +#: ../../library/ast.rst:1271 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1268 +#: ../../library/ast.rst:1273 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2316,7 +2321,7 @@ msgstr "" " orelse=[\n" " Continue()])])])" -#: ../../library/ast.rst:1299 +#: ../../library/ast.rst:1304 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -2324,7 +2329,7 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1302 +#: ../../library/ast.rst:1307 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2400,7 +2405,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1344 +#: ../../library/ast.rst:1349 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -2410,7 +2415,7 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1348 +#: ../../library/ast.rst:1353 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2450,19 +2455,19 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1373 +#: ../../library/ast.rst:1378 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一" -"個 :class:`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子" -"句)。``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則" -"為 ``None``。``body`` 是節點串列。" +"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一個 :class:" +"`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子句)。" +"``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " +"``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1378 +#: ../../library/ast.rst:1383 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2506,7 +2511,7 @@ msgstr "" " body=[\n" " Pass()])])])" -#: ../../library/ast.rst:1404 +#: ../../library/ast.rst:1409 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -2515,19 +2520,18 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1414 +#: ../../library/ast.rst:1419 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is " -"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " -"``None`` if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" +"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " +"if that isn't used." msgstr "" -"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一" -"個 :class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分" -"的 :class:`Name`、:class:`Tuple` 或 :class:`List`,或者如果不使用則為 " -"``None`` 。" +"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一個 :" +"class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" +"class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" -#: ../../library/ast.rst:1419 +#: ../../library/ast.rst:1424 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2573,11 +2577,11 @@ msgstr "" " Name(id='b', ctx=Load()),\n" " Name(id='d', ctx=Load())]))])])" -#: ../../library/ast.rst:1445 +#: ../../library/ast.rst:1450 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1450 +#: ../../library/ast.rst:1455 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -2586,24 +2590,24 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1458 +#: ../../library/ast.rst:1463 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " -"match pattern that the subject will be matched against. Note that " -"the :class:`AST` nodes produced for patterns differ from those produced for " +"match pattern that the subject will be matched against. Note that the :class:" +"`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" "``match`` 陳述式中的單個案例模式。``pattern`` 包含主題將與之匹配的匹配模式。" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1463 +#: ../../library/ast.rst:1468 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1466 +#: ../../library/ast.rst:1471 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -2611,7 +2615,7 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1469 +#: ../../library/ast.rst:1474 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2677,7 +2681,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1507 +#: ../../library/ast.rst:1512 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -2687,7 +2691,7 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1512 +#: ../../library/ast.rst:1517 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2723,7 +2727,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1535 +#: ../../library/ast.rst:1540 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -2733,7 +2737,7 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1539 +#: ../../library/ast.rst:1544 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2767,7 +2771,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1561 +#: ../../library/ast.rst:1566 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -2777,7 +2781,7 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1566 +#: ../../library/ast.rst:1571 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2821,7 +2825,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1593 +#: ../../library/ast.rst:1598 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -2831,7 +2835,7 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1597 +#: ../../library/ast.rst:1602 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2895,7 +2899,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1634 +#: ../../library/ast.rst:1639 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2907,7 +2911,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1640 +#: ../../library/ast.rst:1645 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2919,7 +2923,7 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1646 +#: ../../library/ast.rst:1651 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2979,7 +2983,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1681 +#: ../../library/ast.rst:1686 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2994,7 +2998,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1688 +#: ../../library/ast.rst:1693 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -3003,7 +3007,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1692 +#: ../../library/ast.rst:1697 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -3012,7 +3016,7 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1696 +#: ../../library/ast.rst:1701 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3096,7 +3100,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1743 +#: ../../library/ast.rst:1748 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -3107,7 +3111,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1748 +#: ../../library/ast.rst:1753 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -3116,7 +3120,7 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1752 +#: ../../library/ast.rst:1757 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3172,7 +3176,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1785 +#: ../../library/ast.rst:1790 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -3184,7 +3188,7 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1791 +#: ../../library/ast.rst:1796 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3228,17 +3232,17 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1818 +#: ../../library/ast.rst:1823 msgid "Type annotations" msgstr "" -#: ../../library/ast.rst:1822 +#: ../../library/ast.rst:1827 msgid "" "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " "specified by the form ``# type: ignore ``." msgstr "" -#: ../../library/ast.rst:1825 +#: ../../library/ast.rst:1830 msgid "" ">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " "indent=4))\n" @@ -3284,37 +3288,37 @@ msgstr "" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='[assignment]')])" -#: ../../library/ast.rst:1848 +#: ../../library/ast.rst:1853 msgid "" ":class:`!TypeIgnore` nodes are not generated when the *type_comments* " "parameter is set to ``False`` (default). See :func:`ast.parse` for more " "details." msgstr "" -#: ../../library/ast.rst:1856 +#: ../../library/ast.rst:1861 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1858 +#: ../../library/ast.rst:1863 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1863 +#: ../../library/ast.rst:1868 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is " -"a :class:`Tuple`, it represents constraints; otherwise it represents the " -"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " -"no default, this attribute will be set to ``None``." +"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" +"`Tuple`, it represents constraints; otherwise it represents the bound. " +"``default_value`` is the default value; if the :class:`!TypeVar` has no " +"default, this attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一" -"個 :class:`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如" -"果 :class:`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" +"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" +"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1869 +#: ../../library/ast.rst:1874 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3348,12 +3352,12 @@ msgstr "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1888 ../../library/ast.rst:1923 -#: ../../library/ast.rst:1955 +#: ../../library/ast.rst:1893 ../../library/ast.rst:1928 +#: ../../library/ast.rst:1960 msgid "Added the *default_value* parameter." msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1893 +#: ../../library/ast.rst:1898 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" @@ -3362,7 +3366,7 @@ msgstr "" "一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " "是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1897 +#: ../../library/ast.rst:1902 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" @@ -3410,7 +3414,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1928 +#: ../../library/ast.rst:1933 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " @@ -3420,7 +3424,7 @@ msgstr "" "``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" "會被設為 ``None``。" -#: ../../library/ast.rst:1932 +#: ../../library/ast.rst:1937 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3462,27 +3466,27 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1959 +#: ../../library/ast.rst:1964 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1963 +#: ../../library/ast.rst:1968 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1965 +#: ../../library/ast.rst:1970 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1966 +#: ../../library/ast.rst:1971 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1967 +#: ../../library/ast.rst:1972 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1968 +#: ../../library/ast.rst:1973 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3490,20 +3494,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1970 +#: ../../library/ast.rst:1975 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1971 ../../library/ast.rst:2134 +#: ../../library/ast.rst:1976 ../../library/ast.rst:2139 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1977 ../../library/ast.rst:2161 -#: ../../library/ast.rst:2172 +#: ../../library/ast.rst:1982 ../../library/ast.rst:2166 +#: ../../library/ast.rst:2177 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1983 +#: ../../library/ast.rst:1988 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3511,7 +3515,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1986 +#: ../../library/ast.rst:1991 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3535,17 +3539,17 @@ msgstr "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:2002 +#: ../../library/ast.rst:2007 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:2004 +#: ../../library/ast.rst:2009 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:2005 +#: ../../library/ast.rst:2010 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3553,7 +3557,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:2007 +#: ../../library/ast.rst:2012 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3561,7 +3565,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:2009 +#: ../../library/ast.rst:2014 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3570,7 +3574,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:2016 +#: ../../library/ast.rst:2021 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3578,12 +3582,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:2021 +#: ../../library/ast.rst:2026 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:2023 +#: ../../library/ast.rst:2028 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3657,11 +3661,11 @@ msgstr "" " Name(id='decorator2', ctx=Load())],\n" " returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:2063 +#: ../../library/ast.rst:2068 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:2065 +#: ../../library/ast.rst:2070 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3675,7 +3679,7 @@ msgstr "" " Return(\n" " value=Constant(value=4))])" -#: ../../library/ast.rst:2077 +#: ../../library/ast.rst:2082 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3684,7 +3688,7 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2080 +#: ../../library/ast.rst:2085 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3714,12 +3718,12 @@ msgstr "" " value=YieldFrom(\n" " value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2100 +#: ../../library/ast.rst:2105 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2102 +#: ../../library/ast.rst:2107 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3757,38 +3761,38 @@ msgstr "" " 'y',\n" " 'z'])])" -#: ../../library/ast.rst:2125 +#: ../../library/ast.rst:2130 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2127 +#: ../../library/ast.rst:2132 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名稱的原始字串" -#: ../../library/ast.rst:2128 +#: ../../library/ast.rst:2133 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2129 +#: ../../library/ast.rst:2134 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as " -"per :pep:`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" +"`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2131 +#: ../../library/ast.rst:2136 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2133 +#: ../../library/ast.rst:2138 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2136 +#: ../../library/ast.rst:2141 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3836,25 +3840,25 @@ msgstr "" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2165 +#: ../../library/ast.rst:2170 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2169 +#: ../../library/ast.rst:2174 msgid "" -"An ``async def`` function definition. Has the same fields " -"as :class:`FunctionDef`." +"An ``async def`` function definition. Has the same fields as :class:" +"`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2178 +#: ../../library/ast.rst:2183 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"一個 ``await`` 運算式。``value`` 是它等待的東西。僅" -"在 :class:`AsyncFunctionDef` 主體 (body) 中有效。" +"一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" +"`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2181 +#: ../../library/ast.rst:2186 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3886,7 +3890,7 @@ msgstr "" " value=Call(\n" " func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2202 +#: ../../library/ast.rst:2207 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3895,24 +3899,24 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2207 +#: ../../library/ast.rst:2212 msgid "" -"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " -"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " -"and :class:`ast.expr_context`) on the returned tree will be singletons. " -"Changes to one will be reflected in all other occurrences of the same value " -"(for example, :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" +"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." +"boolop` and :class:`ast.expr_context`) on the returned tree will be " +"singletons. Changes to one will be reflected in all other occurrences of the " +"same value (for example, :class:`ast.Add`)." msgstr "" -"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" -"(:class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast.boolop` " -"和 :class:`ast.expr_context` 的子類別)將是單例。對其中之一的更改將反映在所有其他出" -"現的相同值中(例如 :class:`ast.Add`)。" +"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點(:class:`ast." +"operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast.boolop` 和 :" +"class:`ast.expr_context` 的子類別)將是單例。對其中之一的更改將反映在所有其他" +"出現的相同值中(例如 :class:`ast.Add`)。" -#: ../../library/ast.rst:2215 +#: ../../library/ast.rst:2220 msgid ":mod:`ast` helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2217 +#: ../../library/ast.rst:2222 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3920,37 +3924,37 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2222 +#: ../../library/ast.rst:2227 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " -"``ast.PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." +"PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " "flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " "<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2227 +#: ../../library/ast.rst:2232 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " -"to :func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" +"func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" -"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` " -"和 :pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增" -"到傳遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此" -"旗標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " +"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` 和 :" +"pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增到傳" +"遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此旗" +"標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2237 +#: ../../library/ast.rst:2242 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3960,7 +3964,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2241 +#: ../../library/ast.rst:2246 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3980,12 +3984,12 @@ msgstr "" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2251 +#: ../../library/ast.rst:2256 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2254 +#: ../../library/ast.rst:2259 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3999,14 +4003,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2261 +#: ../../library/ast.rst:2266 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2265 +#: ../../library/ast.rst:2270 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -4014,11 +4018,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2269 +#: ../../library/ast.rst:2274 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2272 +#: ../../library/ast.rst:2277 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." @@ -4026,16 +4030,16 @@ msgstr "" "``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" "數。" -#: ../../library/ast.rst:2279 +#: ../../library/ast.rst:2284 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back " -"with :func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back with :" +"func:`ast.parse`." msgstr "" -"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使" -"用 :func:`ast.parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" +"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." +"parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2284 +#: ../../library/ast.rst:2289 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -4044,13 +4048,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2289 +#: ../../library/ast.rst:2294 msgid "" -"Trying to unparse a highly complex expression would result " -"with :exc:`RecursionError`." +"Trying to unparse a highly complex expression would result with :exc:" +"`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2297 +#: ../../library/ast.rst:2302 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -4061,7 +4065,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2302 +#: ../../library/ast.rst:2307 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -4070,7 +4074,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2307 +#: ../../library/ast.rst:2312 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -4087,62 +4091,60 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2317 +#: ../../library/ast.rst:2322 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2320 +#: ../../library/ast.rst:2325 msgid "" -"It can " -"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " -"and :exc:`RecursionError` depending on the malformed input." +"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" +"`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" -"它可能會引" -"發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:`MemoryError` " -"和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" +"它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" +"`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2324 +#: ../../library/ast.rst:2329 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2327 +#: ../../library/ast.rst:2332 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2330 +#: ../../library/ast.rst:2335 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2336 +#: ../../library/ast.rst:2341 msgid "" -"Return the docstring of the given *node* (which must be " -"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " -"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " -"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be a :class:" +"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" +"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " +"clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"回傳給定 *node* 的文件字串 (docstring)(必須" -"是 :class:`FunctionDef`、:class:`AsyncFunctionDef`、:class:`ClassDef` " -"或 :class:`Module` 節點)或如果它沒有文件字串則為 ``None``。如果 *clean* 為 " -"true,則使用 :func:`inspect.cleandoc` 清理文件字串的縮排。" +"回傳給定 *node* 的文件字串 (docstring)(必須是 :class:`FunctionDef`、:class:" +"`AsyncFunctionDef`、:class:`ClassDef` 或 :class:`Module` 節點)或如果它沒有文" +"件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" +"理文件字串的縮排。" -#: ../../library/ast.rst:2342 +#: ../../library/ast.rst:2347 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2348 +#: ../../library/ast.rst:2353 msgid "" "Get source code segment of the *source* that generated *node*. If some " -"location information " -"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " -"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." +"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" +"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " +"return ``None``." msgstr "" -"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" -"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " -"或 :attr:`~ast.AST.end_col_offset`)遺漏,則回傳 ``None``。" +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." +"lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" +"`~ast.AST.end_col_offset`)遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2352 +#: ../../library/ast.rst:2357 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -4150,22 +4152,21 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2360 +#: ../../library/ast.rst:2365 msgid "" -"When you compile a node tree with :func:`compile`, the compiler " -"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " -"for every node that supports them. This is rather tedious to fill in for " -"generated nodes, so this helper adds these attributes recursively where not " -"already set, by setting them to the values of the parent node. It works " -"recursively starting at *node*." +"When you compile a node tree with :func:`compile`, the compiler expects :" +"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " +"node that supports them. This is rather tedious to fill in for generated " +"nodes, so this helper adds these attributes recursively where not already " +"set, by setting them to the values of the parent node. It works recursively " +"starting at *node*." msgstr "" -"當你使用 :func:`compile` 編譯節點樹時,對於每個有支" -"援 :attr:`~ast.AST.lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器" -"預期他們的這些屬性都要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些" -"屬性設定為父節點的值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞" -"迴地作用。" +"當你使用 :func:`compile` 編譯節點樹時,對於每個有支援 :attr:`~ast.AST." +"lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器預期他們的這些屬性都" +"要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" +"值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2369 +#: ../../library/ast.rst:2374 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4174,19 +4175,17 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2376 +#: ../../library/ast.rst:2381 msgid "" -"Copy source location " -"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " -"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " -"possible, and return *new_node*." +"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" +"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " +"*old_node* to *new_node* if possible, and return *new_node*." msgstr "" -"如果可行,將原始位置" -"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno` " -"和 :attr:`~ast.AST.end_col_offset` )從 *old_node* 複製到 *new_node*,並回傳 " -"*new_node* 。" +"如果可行,將原始位置(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:" +"attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " +"*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2383 +#: ../../library/ast.rst:2388 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4194,7 +4193,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2389 +#: ../../library/ast.rst:2394 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4202,7 +4201,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2395 +#: ../../library/ast.rst:2400 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4211,7 +4210,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2402 +#: ../../library/ast.rst:2407 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4220,27 +4219,27 @@ msgstr "" "節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2406 +#: ../../library/ast.rst:2411 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" -#: ../../library/ast.rst:2411 +#: ../../library/ast.rst:2416 msgid "" -"Visit a node. The default implementation calls the method " -"called :samp:`self.visit_{classname}` where *classname* is the name of the " -"node class, or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method called :samp:" +"`self.visit_{classname}` where *classname* is the name of the node class, " +"or :meth:`generic_visit` if that method doesn't exist." msgstr "" "瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " -"*classname* 是節點類別的名稱,或者在該方法不存在時呼" -"叫 :meth:`generic_visit`。" +"*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" +"`generic_visit`。" -#: ../../library/ast.rst:2417 +#: ../../library/ast.rst:2422 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2419 +#: ../../library/ast.rst:2424 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4248,38 +4247,38 @@ msgstr "" "請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" "自定義瀏覽者方法的節點之子節點。" -#: ../../library/ast.rst:2425 +#: ../../library/ast.rst:2430 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2427 +#: ../../library/ast.rst:2432 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists " -"(:class:`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists (:class:" +"`NodeTransformer`) that allows modifications." msgstr "" -"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使" -"用 :class:`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工" -"具 :class:`NodeTransformer`。" +"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" +"`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工具 :class:" +"`NodeTransformer`。" -#: ../../library/ast.rst:2433 +#: ../../library/ast.rst:2438 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" -"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " -"deprecated now and will not be called in future Python versions. Add " -"the :meth:`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" +"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " +"will not be called in future Python versions. Add the :meth:" +"`visit_Constant` method to handle all constant nodes." msgstr "" ":meth:`!visit_Num`、:meth:`!visit_Str`、:meth:`!visit_Bytes`、:meth:`!" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2441 +#: ../../library/ast.rst:2446 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2444 +#: ../../library/ast.rst:2449 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4291,7 +4290,7 @@ msgstr "" "點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2450 +#: ../../library/ast.rst:2455 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4299,7 +4298,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2458 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4319,16 +4318,16 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2462 +#: ../../library/ast.rst:2467 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " -"either transform the child nodes yourself or call " -"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." +"either transform the child nodes yourself or call the :meth:`~ast." +"NodeVisitor.generic_visit` method for the node first." msgstr "" -"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點" -"的 :meth:`~ast.NodeVisitor.generic_visit` 方法。" +"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" +"meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2466 +#: ../../library/ast.rst:2471 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4337,18 +4336,18 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2470 +#: ../../library/ast.rst:2475 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " -"original tree) without giving them location information (such " -"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " -"with the new sub-tree to recalculate the location information::" +"original tree) without giving them location information (such as :attr:`~ast." +"AST.lineno`), :func:`fix_missing_locations` should be called with the new " +"sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`),則應使用新的子樹呼" -"叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`),則應使用新的子樹呼叫 :func:" +"`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2475 +#: ../../library/ast.rst:2480 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4356,15 +4355,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2478 +#: ../../library/ast.rst:2483 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2480 +#: ../../library/ast.rst:2485 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2490 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4380,7 +4379,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2493 +#: ../../library/ast.rst:2498 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4394,7 +4393,7 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2500 +#: ../../library/ast.rst:2505 msgid "" "If *show_empty* is false (the default), optional empty lists will be omitted " "from the output. Optional ``None`` values are always omitted." @@ -4402,15 +4401,15 @@ msgstr "" "如果 *show_empty* 為 false(預設值),則輸出中將省略可選的空串列。可選的 " "``None`` 值總是會被省略。" -#: ../../library/ast.rst:2504 +#: ../../library/ast.rst:2509 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2507 +#: ../../library/ast.rst:2512 msgid "Added the *show_empty* option." msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2510 +#: ../../library/ast.rst:2515 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4462,17 +4461,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2541 +#: ../../library/ast.rst:2546 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2543 +#: ../../library/ast.rst:2548 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2548 +#: ../../library/ast.rst:2553 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4480,21 +4479,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2555 +#: ../../library/ast.rst:2560 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2560 +#: ../../library/ast.rst:2565 msgid "" -"The returned AST is optimized according to the *optimize* argument " -"in :func:`compile` or :func:`ast.parse`." +"The returned AST is optimized according to the *optimize* argument in :func:" +"`compile` or :func:`ast.parse`." msgstr "" "回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" "行最佳化。" -#: ../../library/ast.rst:2567 +#: ../../library/ast.rst:2572 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4502,11 +4501,11 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2575 +#: ../../library/ast.rst:2580 msgid "Recursively compares two ASTs." msgstr "" -#: ../../library/ast.rst:2577 +#: ../../library/ast.rst:2582 msgid "" "*compare_attributes* affects whether AST attributes are considered in the " "comparison. If *compare_attributes* is ``False`` (default), then attributes " @@ -4515,63 +4514,63 @@ msgid "" "similar details. Attributes include line numbers and column offsets." msgstr "" -#: ../../library/ast.rst:2590 +#: ../../library/ast.rst:2595 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/ast.rst:2594 +#: ../../library/ast.rst:2599 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2597 +#: ../../library/ast.rst:2602 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2601 +#: ../../library/ast.rst:2606 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2607 +#: ../../library/ast.rst:2612 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2612 +#: ../../library/ast.rst:2617 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument " -"in :func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument in :" +"func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2617 +#: ../../library/ast.rst:2622 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2621 +#: ../../library/ast.rst:2626 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2626 +#: ../../library/ast.rst:2631 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2630 +#: ../../library/ast.rst:2635 msgid "" "Python version in the format 3.x (for example, 3.10). Defaults to the " "current version of the interpreter." msgstr "" -#: ../../library/ast.rst:2638 +#: ../../library/ast.rst:2643 msgid "Optimization level for parser. Defaults to no optimization." msgstr "" -#: ../../library/ast.rst:2644 +#: ../../library/ast.rst:2649 msgid "" "Show empty lists and fields that are ``None``. Defaults to not showing empty " "objects." msgstr "" -#: ../../library/ast.rst:2650 +#: ../../library/ast.rst:2655 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4579,7 +4578,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2656 +#: ../../library/ast.rst:2661 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4587,7 +4586,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2659 +#: ../../library/ast.rst:2664 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4598,7 +4597,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2664 +#: ../../library/ast.rst:2669 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4608,7 +4607,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2669 +#: ../../library/ast.rst:2674 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4618,7 +4617,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2674 +#: ../../library/ast.rst:2679 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 29ef9ec453..7f18a47ce5 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 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,8 +97,8 @@ 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``。" @@ -127,10 +127,10 @@ msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。 #: ../../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`,表示這個條目已經被取回且被它包含的所有工作都已完" @@ -162,40 +162,64 @@ msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" #: ../../library/asyncio-queue.rst:105 -msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`QueueShutDown`." +msgid "Put a :class:`Queue` instance into a shutdown mode." msgstr "" -#: ../../library/asyncio-queue.rst:108 +#: ../../library/asyncio-queue.rst:107 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." +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`QueueShutDown` in the formerly blocked thread." msgstr "" #: ../../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`." +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" + +#: ../../library/asyncio-queue.rst:116 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." msgstr "" -#: ../../library/asyncio-queue.rst:121 +#: ../../library/asyncio-queue.rst:119 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`QueueShutDown`." +msgstr "" + +#: ../../library/asyncio-queue.rst:122 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty. All callers of :meth:`~Queue.join` are " +"unblocked regardless of the number of unfinished tasks. Blocked callers of :" +"meth:`~Queue.get` are unblocked and will raise :exc:`QueueShutDown` because " +"the queue is empty." +msgstr "" + +#: ../../library/asyncio-queue.rst:129 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." +msgstr "" + +#: ../../library/asyncio-queue.rst:137 msgid "Indicate that a formerly enqueued work item is complete." msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:123 +#: ../../library/asyncio-queue.rst:139 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:127 +#: ../../library/asyncio-queue.rst:143 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 +228,47 @@ msgstr "" "如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../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:135 +#: ../../library/asyncio-queue.rst:148 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:140 +#: ../../library/asyncio-queue.rst:153 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:157 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:147 +#: ../../library/asyncio-queue.rst:160 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:152 +#: ../../library/asyncio-queue.rst:165 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:156 +#: ../../library/asyncio-queue.rst:169 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:161 +#: ../../library/asyncio-queue.rst:174 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:165 +#: ../../library/asyncio-queue.rst:178 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:171 +#: ../../library/asyncio-queue.rst:184 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -258,22 +276,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:177 +#: ../../library/asyncio-queue.rst:190 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:184 +#: ../../library/asyncio-queue.rst:197 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:188 +#: ../../library/asyncio-queue.rst:201 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:191 +#: ../../library/asyncio-queue.rst:204 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 0ed40b78cb..064b189944 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-19 00:16+0000\n" +"POT-Creation-Date: 2025-10-05 00:16+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:440 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:441 msgid "" "import asyncio\n" "\n" @@ -146,7 +146,7 @@ msgstr "移除 *loop* 參數。" #: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 #: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:202 -#: ../../library/asyncio-stream.rst:407 +#: ../../library/asyncio-stream.rst:408 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" @@ -409,11 +409,17 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:319 ../../library/asyncio-stream.rst:334 +#: ../../library/asyncio-stream.rst:319 +msgid "" +"The *data* buffer should be a bytes, bytearray, or C-contiguous one-" +"dimensional memoryview object." +msgstr "" + +#: ../../library/asyncio-stream.rst:322 ../../library/asyncio-stream.rst:335 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:321 +#: ../../library/asyncio-stream.rst:324 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -421,13 +427,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:325 -msgid "" -"The *data* buffer should be a C contiguous one-dimensional :term:`bytes-like " -"object `." -msgstr "" - -#: ../../library/asyncio-stream.rst:329 +#: ../../library/asyncio-stream.rst:330 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 " @@ -436,7 +436,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:336 +#: ../../library/asyncio-stream.rst:337 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -444,17 +444,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:341 +#: ../../library/asyncio-stream.rst:342 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:344 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:346 +#: ../../library/asyncio-stream.rst:347 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -462,7 +462,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:351 +#: ../../library/asyncio-stream.rst:352 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -470,26 +470,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:356 +#: ../../library/asyncio-stream.rst:357 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:361 +#: ../../library/asyncio-stream.rst:362 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:365 +#: ../../library/asyncio-stream.rst:366 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:371 +#: ../../library/asyncio-stream.rst:372 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:374 +#: ../../library/asyncio-stream.rst:375 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -497,7 +497,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:378 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()* " @@ -509,48 +509,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:388 +#: ../../library/asyncio-stream.rst:389 msgid "Upgrade an existing stream-based connection to TLS." msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:390 +#: ../../library/asyncio-stream.rst:391 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:392 +#: ../../library/asyncio-stream.rst:393 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:394 +#: ../../library/asyncio-stream.rst:395 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:397 +#: ../../library/asyncio-stream.rst:398 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:401 +#: ../../library/asyncio-stream.rst:402 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:413 +#: ../../library/asyncio-stream.rst:414 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:421 +#: ../../library/asyncio-stream.rst:422 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:423 +#: ../../library/asyncio-stream.rst:424 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 " @@ -559,19 +559,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:431 +#: ../../library/asyncio-stream.rst:432 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:436 +#: ../../library/asyncio-stream.rst:437 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 用戶端" -#: ../../library/asyncio-stream.rst:438 +#: ../../library/asyncio-stream.rst:439 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 用戶端: ::" -#: ../../library/asyncio-stream.rst:462 +#: ../../library/asyncio-stream.rst:463 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -580,15 +580,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 用戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:469 +#: ../../library/asyncio-stream.rst:470 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:471 +#: ../../library/asyncio-stream.rst:472 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:473 +#: ../../library/asyncio-stream.rst:474 msgid "" "import asyncio\n" "\n" @@ -648,7 +648,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:505 +#: ../../library/asyncio-stream.rst:506 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -657,16 +657,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:510 +#: ../../library/asyncio-stream.rst:511 msgid "Get HTTP headers" msgstr "取得 HTTP 標頭" -#: ../../library/asyncio-stream.rst:512 +#: ../../library/asyncio-stream.rst:513 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:514 +#: ../../library/asyncio-stream.rst:515 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -705,34 +705,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:551 +#: ../../library/asyncio-stream.rst:552 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:553 +#: ../../library/asyncio-stream.rst:554 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:555 +#: ../../library/asyncio-stream.rst:556 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:557 +#: ../../library/asyncio-stream.rst:558 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:563 +#: ../../library/asyncio-stream.rst:564 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:565 +#: ../../library/asyncio-stream.rst:566 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:568 +#: ../../library/asyncio-stream.rst:569 msgid "" "import asyncio\n" "import socket\n" @@ -765,7 +765,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:600 +#: ../../library/asyncio-stream.rst:601 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -775,7 +775,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:604 +#: ../../library/asyncio-stream.rst:605 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/bisect.po b/library/bisect.po index 5d583395d6..e18d196ae0 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -370,6 +370,35 @@ msgid "" " Movie(name='Aliens', released=1986, director='Cameron'),\n" " Movie(name='Titanic', released=1997, director='Cameron')]" msgstr "" +">>> from collections import namedtuple\n" +">>> from operator import attrgetter\n" +">>> from bisect import bisect, insort\n" +">>> from pprint import pprint\n" +"\n" +">>> Movie = namedtuple('Movie', ('name', 'released', 'director'))\n" +"\n" +">>> movies = [\n" +"... Movie('Jaws', 1975, 'Spielberg'),\n" +"... Movie('Titanic', 1997, 'Cameron'),\n" +"... Movie('The Birds', 1963, 'Hitchcock'),\n" +"... Movie('Aliens', 1986, 'Cameron')\n" +"... ]\n" +"\n" +">>> # 找到 1960 年後上映的第一部電影\n" +">>> by_year = attrgetter('released')\n" +">>> movies.sort(key=by_year)\n" +">>> movies[bisect(movies, 1960, key=by_year)]\n" +"Movie(name='The Birds', released=1963, director='Hitchcock')\n" +"\n" +">>> # 插入一部電影並保持排序\n" +">>> romance = Movie('Love Story', 1970, 'Hiller')\n" +">>> insort(movies, romance, key=by_year)\n" +">>> pprint(movies)\n" +"[Movie(name='The Birds', released=1963, director='Hitchcock'),\n" +" Movie(name='Love Story', released=1970, director='Hiller'),\n" +" Movie(name='Jaws', released=1975, director='Spielberg'),\n" +" Movie(name='Aliens', released=1986, director='Cameron'),\n" +" Movie(name='Titanic', released=1997, director='Cameron')]" #: ../../library/bisect.rst:247 msgid "" diff --git a/library/cmath.po b/library/cmath.po index cf69d27a6e..1106996067 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-15 00:16+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-" @@ -33,9 +33,9 @@ msgid "" "result of the conversion." msgstr "" "本模組提供一些適用於複數的數學函式。本模組中的函式接受整數、浮點數或複數作為" -"引數。它們也接受任何具有 :meth:`~object.__complex__` " -"或 :meth:`~object.__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為" -"複數或浮點數,然後再將函式應用於轉換後的結果。" +"引數。它們也接受任何具有 :meth:`~object.__complex__` 或 :meth:`~object." +"__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為複數或浮點數,然後" +"再將函式應用於轉換後的結果。" #: ../../library/cmath.rst:18 msgid "" @@ -60,9 +60,8 @@ msgid "" "*below* the branch cut, and so gives a result on the negative imaginary " "axis::" msgstr "" -"例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 " -"``-2-0j`` 被視為位於分枝切割 *下方* 處理,因此給出的結果在負虛" -"軸上: ::" +"例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 ``-2-0j`` 被視" +"為位於分枝切割 *下方* 處理,因此給出的結果在負虛軸上: ::" #: ../../library/cmath.rst:31 msgid "" @@ -357,8 +356,8 @@ 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.real`` and its *imaginary part* ``z.imag``." +"*Cartesian* coordinates. It is completely determined by its *real part* ``z." +"real`` and its *imaginary part* ``z.imag``." msgstr "" "Python 複數 ``z`` 是用 *直角坐標* 或 *笛卡爾坐標* 儲存在內部的。它完全是由其 " "*實部* ``z.real`` 和 *虛部* ``z.imag`` 所決定。" @@ -392,8 +391,8 @@ msgid "" msgstr "" "以浮點數的形式回傳 *z* 的相位角(也稱為 *z* 的 *引數* )。``phase(z)`` 等價" "於 ``math.atan2(z.imag, z.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" -"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 " -"``z.imag`` 為零: ::" +"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 ``z." +"imag`` 為零: ::" #: ../../library/cmath.rst:117 msgid "" @@ -413,8 +412,8 @@ msgid "" "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" -"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨" -"的 :mod:`cmath` 模組函式適用於此操作。" +"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨的 :mod:" +"`cmath` 模組函式適用於此操作。" #: ../../library/cmath.rst:132 msgid "" @@ -454,8 +453,8 @@ msgstr "" #: ../../library/cmath.rst:162 msgid "" -"Return the base-10 logarithm of *z*. This has the same branch cut " -"as :func:`log`." +"Return the base-10 logarithm of *z*. This has the same branch cut as :func:" +"`log`." msgstr "回傳 *z* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" #: ../../library/cmath.rst:168 @@ -647,8 +646,8 @@ msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, fl #: ../../library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " -"``float('nan')``." -msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" +"``float('nan')``. See also :data:`math.nan`." +msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。另請參閱 :data:`math.nan`。" #: ../../library/cmath.rst:348 msgid "" @@ -662,16 +661,15 @@ msgid "" "in module :mod:`math`. The reason for having two modules is that some users " "aren't interested in complex numbers, and perhaps don't even know what they " "are. They would rather have ``math.sqrt(-1)`` raise an exception than " -"return a complex number. Also note that the functions defined " -"in :mod:`cmath` always return a complex number, even if the answer can be " -"expressed as a real number (in which case the complex number has an " -"imaginary part of zero)." +"return a complex number. Also note that the functions defined in :mod:" +"`cmath` always return a complex number, even if the answer can be expressed " +"as a real number (in which case the complex number has an imaginary part of " +"zero)." msgstr "" "請注意,函式的選擇與模組 :mod:`math` 的類似,但並不完全相同。擁有兩個模組的原" -"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 " -"``math.sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定" -"義的函式始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為" -"零)。" +"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 ``math." +"sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" +"始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" #: ../../library/cmath.rst:364 msgid "" diff --git a/library/codecs.po b/library/codecs.po index e9bfa3e9fe..7acae8c1c1 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-19 00:16+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-" @@ -51,9 +51,9 @@ msgstr "" #: ../../library/codecs.rst:40 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that encoding errors " -"raise :exc:`ValueError` (or a more codec specific subclass, such " -"as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that encoding errors raise :exc:" +"`ValueError` (or a more codec specific subclass, such as :exc:" +"`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -64,9 +64,9 @@ msgstr "" #: ../../library/codecs.rst:50 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that decoding errors " -"raise :exc:`ValueError` (or a more codec specific subclass, such " -"as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that decoding errors raise :exc:" +"`ValueError` (or a more codec specific subclass, such as :exc:" +"`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -85,17 +85,16 @@ msgstr "" #: ../../library/codecs.rst:68 msgid "" -"Looks up the codec info in the Python codec registry and returns " -"a :class:`CodecInfo` object as defined below." +"Looks up the codec info in the Python codec registry and returns a :class:" +"`CodecInfo` object as defined below." msgstr "" #: ../../library/codecs.rst:71 msgid "" "Encodings are first looked up in the registry's cache. If not found, the " "list of registered search functions is scanned. If no :class:`CodecInfo` " -"object is found, a :exc:`LookupError` is raised. Otherwise, " -"the :class:`CodecInfo` object is stored in the cache and returned to the " -"caller." +"object is found, a :exc:`LookupError` is raised. Otherwise, the :class:" +"`CodecInfo` object is stored in the cache and returned to the caller." msgstr "" #: ../../library/codecs.rst:78 @@ -111,25 +110,25 @@ msgstr "編碼的名稱。" #: ../../library/codecs.rst:90 msgid "" "The stateless encoding and decoding functions. These must be functions or " -"methods which have the same interface as the :meth:`~Codec.encode` " -"and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec " -"Interface `). The functions or methods are expected to work " -"in a stateless mode." +"methods which have the same interface as the :meth:`~Codec.encode` and :meth:" +"`~Codec.decode` methods of Codec instances (see :ref:`Codec Interface `). The functions or methods are expected to work in a stateless " +"mode." msgstr "" #: ../../library/codecs.rst:100 msgid "" "Incremental encoder and decoder classes or factory functions. These have to " -"provide the interface defined by the base " -"classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, " -"respectively. Incremental codecs can maintain state." +"provide the interface defined by the base classes :class:" +"`IncrementalEncoder` and :class:`IncrementalDecoder`, respectively. " +"Incremental codecs can maintain state." msgstr "" #: ../../library/codecs.rst:109 msgid "" "Stream writer and reader classes or factory functions. These have to provide " -"the interface defined by the base classes :class:`StreamWriter` " -"and :class:`StreamReader`, respectively. Stream codecs can maintain state." +"the interface defined by the base classes :class:`StreamWriter` and :class:" +"`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" #: ../../library/codecs.rst:114 @@ -179,14 +178,14 @@ msgstr "" #: ../../library/codecs.rst:151 msgid "" -"Look up the codec for the given encoding and return " -"its :class:`StreamReader` class or factory function." +"Look up the codec for the given encoding and return its :class:" +"`StreamReader` class or factory function." msgstr "" #: ../../library/codecs.rst:159 msgid "" -"Look up the codec for the given encoding and return " -"its :class:`StreamWriter` class or factory function." +"Look up the codec for the given encoding and return its :class:" +"`StreamWriter` class or factory function." msgstr "" #: ../../library/codecs.rst:164 @@ -224,9 +223,9 @@ msgstr "" #: ../../library/codecs.rst:194 msgid "" -"Open an encoded file using the given *mode* and return an instance " -"of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The " -"default file mode is ``'r'``, meaning to open the file in read mode." +"Open an encoded file using the given *mode* and return an instance of :class:" +"`StreamReaderWriter`, providing transparent encoding/decoding. The default " +"file mode is ``'r'``, meaning to open the file in read mode." msgstr "" #: ../../library/codecs.rst:200 @@ -294,8 +293,8 @@ msgstr "" #: ../../library/codecs.rst:245 msgid "" "Uses an incremental encoder to iteratively encode the input provided by " -"*iterator*. *iterator* must yield :class:`str` objects. This function is " -"a :term:`generator`. The *errors* argument (as well as any other keyword " +"*iterator*. *iterator* must yield :class:`str` objects. This function is a :" +"term:`generator`. The *errors* argument (as well as any other keyword " "argument) is passed through to the incremental encoder." msgstr "" @@ -318,8 +317,8 @@ msgstr "" msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " -"``rot_13``, although ``rot_13`` may be used equivalently " -"with :func:`iterencode`." +"``rot_13``, although ``rot_13`` may be used equivalently with :func:" +"`iterencode`." msgstr "" #: ../../library/codecs.rst:270 @@ -352,11 +351,11 @@ msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " "streams to indicate the byte order used, and in UTF-8 as a Unicode " -"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` " -"or :const:`BOM_UTF16_LE` depending on the platform's native byte " -"order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` " -"for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The " -"others represent the BOM in UTF-8 and UTF-32 encodings." +"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` or :const:" +"`BOM_UTF16_LE` depending on the platform's native byte order, :const:`BOM` " +"is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` for :const:" +"`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The others " +"represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" #: ../../library/codecs.rst:311 @@ -401,8 +400,8 @@ msgid "Value" msgstr "" #: ../../library/codecs.rst:356 ../../library/codecs.rst:399 -#: ../../library/codecs.rst:419 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:419 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Meaning" msgstr "含義" @@ -444,10 +443,9 @@ msgstr "``'backslashreplace'``" #: ../../library/codecs.rst:372 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " -"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}" -"` :samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value " -"with format :samp:`\\\\x{hh}`. Implemented " -"in :func:`backslashreplace_errors`." +"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :" +"samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value with " +"format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." msgstr "" #: ../../library/codecs.rst:381 @@ -464,8 +462,8 @@ msgstr "" #: ../../library/codecs.rst:395 msgid "" -"The following error handlers are only applicable to encoding " -"(within :term:`text encodings `):" +"The following error handlers are only applicable to encoding (within :term:" +"`text encodings `):" msgstr "" #: ../../library/codecs.rst:401 @@ -475,8 +473,8 @@ msgstr "``'xmlcharrefreplace'``" #: ../../library/codecs.rst:401 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " -"of Unicode code point with format :samp:`&#{num};`. Implemented " -"in :func:`xmlcharrefreplace_errors`." +"of Unicode code point with format :samp:`&#{num};`. Implemented in :func:" +"`xmlcharrefreplace_errors`." msgstr "" #: ../../library/codecs.rst:407 @@ -486,8 +484,8 @@ msgstr "``'namereplace'``" #: ../../library/codecs.rst:407 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " -"the Name property from Unicode Character Database. Implemented " -"in :func:`namereplace_errors`." +"the Name property from Unicode Character Database. Implemented in :func:" +"`namereplace_errors`." msgstr "" #: ../../library/codecs.rst:416 @@ -549,18 +547,17 @@ msgstr "" #: ../../library/codecs.rst:451 msgid "" -"For encoding, *error_handler* will be called with " -"a :exc:`UnicodeEncodeError` instance, which contains information about the " -"location of the error. The error handler must either raise this or a " -"different exception, or return a tuple with a replacement for the " -"unencodable part of the input and a position where encoding should continue. " -"The replacement may be either :class:`str` or :class:`bytes`. If the " -"replacement is bytes, the encoder will simply copy them into the output " -"buffer. If the replacement is a string, the encoder will encode the " -"replacement. Encoding continues on original input at the specified position. " -"Negative position values will be treated as being relative to the end of the " -"input string. If the resulting position is out of bound an :exc:`IndexError` " -"will be raised." +"For encoding, *error_handler* will be called with a :exc:" +"`UnicodeEncodeError` instance, which contains information about the location " +"of the error. The error handler must either raise this or a different " +"exception, or return a tuple with a replacement for the unencodable part of " +"the input and a position where encoding should continue. The replacement may " +"be either :class:`str` or :class:`bytes`. If the replacement is bytes, the " +"encoder will simply copy them into the output buffer. If the replacement is " +"a string, the encoder will encode the replacement. Encoding continues on " +"original input at the specified position. Negative position values will be " +"treated as being relative to the end of the input string. If the resulting " +"position is out of bound an :exc:`IndexError` will be raised." msgstr "" #: ../../library/codecs.rst:463 @@ -636,8 +633,8 @@ msgstr "" #: ../../library/codecs.rst:519 msgid "" -"Implements the ``'xmlcharrefreplace'`` error handling (for encoding " -"within :term:`text encoding` only)." +"Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" +"term:`text encoding` only)." msgstr "" #: ../../library/codecs.rst:522 @@ -649,8 +646,8 @@ msgstr "" #: ../../library/codecs.rst:529 msgid "" -"Implements the ``'namereplace'`` error handling (for encoding " -"within :term:`text encoding` only)." +"Implements the ``'namereplace'`` error handling (for encoding within :term:" +"`text encoding` only)." msgstr "" #: ../../library/codecs.rst:532 @@ -687,9 +684,9 @@ msgstr "" #: ../../library/codecs.rst:561 msgid "" -"The method may not store state in the :class:`Codec` instance. " -"Use :class:`StreamWriter` for codecs which have to keep state in order to " -"make encoding efficient." +"The method may not store state in the :class:`Codec` instance. Use :class:" +"`StreamWriter` for codecs which have to keep state in order to make encoding " +"efficient." msgstr "" #: ../../library/codecs.rst:565 @@ -715,9 +712,9 @@ msgstr "" #: ../../library/codecs.rst:583 msgid "" -"The method may not store state in the :class:`Codec` instance. " -"Use :class:`StreamReader` for codecs which have to keep state in order to " -"make decoding efficient." +"The method may not store state in the :class:`Codec` instance. Use :class:" +"`StreamReader` for codecs which have to keep state in order to make decoding " +"efficient." msgstr "" #: ../../library/codecs.rst:587 @@ -735,18 +732,18 @@ msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" "decoding the input isn't done with one call to the stateless encoder/decoder " -"function, but with multiple calls to " -"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " -"method of the incremental encoder/decoder. The incremental encoder/decoder " -"keeps track of the encoding/decoding process during method calls." +"function, but with multiple calls to the :meth:`~IncrementalEncoder.encode`/:" +"meth:`~IncrementalDecoder.decode` method of the incremental encoder/decoder. " +"The incremental encoder/decoder keeps track of the encoding/decoding process " +"during method calls." msgstr "" #: ../../library/codecs.rst:602 msgid "" -"The joined output of calls to " -"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " -"method is the same as if all the single inputs were joined into one, and " -"this input was encoded/decoded with the stateless encoder/decoder." +"The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" +"`~IncrementalDecoder.decode` method is the same as if all the single inputs " +"were joined into one, and this input was encoded/decoded with the stateless " +"encoder/decoder." msgstr "" #: ../../library/codecs.rst:611 @@ -782,21 +779,21 @@ msgstr "" msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of " -"the :class:`IncrementalEncoder` object." +"error handling strategies during the lifetime of the :class:" +"`IncrementalEncoder` object." msgstr "" #: ../../library/codecs.rst:638 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " -"returns the resulting encoded object. If this is the last call " -"to :meth:`encode` *final* must be true (the default is false)." +"returns the resulting encoded object. If this is the last call to :meth:" +"`encode` *final* must be true (the default is false)." msgstr "" #: ../../library/codecs.rst:645 msgid "" -"Reset the encoder to the initial state. The output is discarded: call " -"``.encode(object, final=True)``, passing an empty byte or text string if " +"Reset the encoder to the initial state. The output is discarded: call ``." +"encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" @@ -848,19 +845,19 @@ msgstr "" msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of " -"the :class:`IncrementalDecoder` object." +"error handling strategies during the lifetime of the :class:" +"`IncrementalDecoder` object." msgstr "" #: ../../library/codecs.rst:695 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " -"returns the resulting decoded object. If this is the last call " -"to :meth:`decode` *final* must be true (the default is false). If *final* is " -"true the decoder must decode the input completely and must flush all " -"buffers. If this isn't possible (e.g. because of incomplete byte sequences " -"at the end of the input) it must initiate error handling just like in the " -"stateless case (which might raise an exception)." +"returns the resulting decoded object. If this is the last call to :meth:" +"`decode` *final* must be true (the default is false). If *final* is true the " +"decoder must decode the input completely and must flush all buffers. If this " +"isn't possible (e.g. because of incomplete byte sequences at the end of the " +"input) it must initiate error handling just like in the stateless case " +"(which might raise an exception)." msgstr "" #: ../../library/codecs.rst:706 @@ -1015,8 +1012,8 @@ msgstr "" #: ../../library/codecs.rst:823 msgid "" -"The set of allowed values for the *errors* argument can be extended " -"with :func:`register_error`." +"The set of allowed values for the *errors* argument can be extended with :" +"func:`register_error`." msgstr "" #: ../../library/codecs.rst:829 @@ -1082,8 +1079,8 @@ msgstr "" #: ../../library/codecs.rst:872 msgid "" -"*sizehint*, if given, is passed as the *size* argument to the " -"stream's :meth:`read` method." +"*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" +"`read` method." msgstr "" #: ../../library/codecs.rst:880 @@ -1110,8 +1107,8 @@ msgstr "" #: ../../library/codecs.rst:895 ../../library/codecs.rst:919 msgid "" -"The design is such that one can use the factory functions returned by " -"the :func:`lookup` function to construct the instance." +"The design is such that one can use the factory functions returned by the :" +"func:`lookup` function to construct the instance." msgstr "" #: ../../library/codecs.rst:901 @@ -1125,8 +1122,8 @@ msgstr "" #: ../../library/codecs.rst:906 msgid "" -":class:`StreamReaderWriter` instances define the combined interfaces " -"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +":class:`StreamReaderWriter` instances define the combined interfaces of :" +"class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" @@ -1174,9 +1171,9 @@ msgstr "" #: ../../library/codecs.rst:945 msgid "" -":class:`StreamRecoder` instances define the combined interfaces " -"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " -"other methods and attributes from the underlying stream." +":class:`StreamRecoder` instances define the combined interfaces of :class:" +"`StreamReader` and :class:`StreamWriter` classes. They inherit all other " +"methods and attributes from the underlying stream." msgstr "" #: ../../library/codecs.rst:953 @@ -1223,30 +1220,38 @@ msgid "" "Unicode code point, is to store each code point as four consecutive bytes. " "There are two possibilities: store the bytes in big endian or in little " "endian order. These two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` " -"respectively. Their disadvantage is that if e.g. you use ``UTF-32-BE`` on a " -"little endian machine you will always have to swap bytes on encoding and " -"decoding. ``UTF-32`` avoids this problem: bytes will always be in natural " -"endianness. When these bytes are read by a CPU with a different endianness, " -"then bytes have to be swapped though. To be able to detect the endianness of " -"a ``UTF-16`` or ``UTF-32`` byte sequence, there's the so called BOM (\"Byte " -"Order Mark\"). This is the Unicode character ``U+FEFF``. This character can " -"be prepended to every ``UTF-16`` or ``UTF-32`` byte sequence. The byte " -"swapped version of this character (``0xFFFE``) is an illegal character that " -"may not appear in a Unicode text. So when the first character in a " -"``UTF-16`` or ``UTF-32`` byte sequence appears to be a ``U+FFFE`` the bytes " -"have to be swapped on decoding. Unfortunately the character ``U+FEFF`` had a " -"second purpose as a ``ZERO WIDTH NO-BREAK SPACE``: a character that has no " -"width and doesn't allow a word to be split. It can e.g. be used to give " -"hints to a ligature algorithm. With Unicode 4.0 using ``U+FEFF`` as a ``ZERO " -"WIDTH NO-BREAK SPACE`` has been deprecated (with ``U+2060`` (``WORD " -"JOINER``) assuming this role). Nevertheless Unicode software still must be " -"able to handle ``U+FEFF`` in both roles: as a BOM it's a device to determine " -"the storage layout of the encoded bytes, and vanishes once the byte sequence " -"has been decoded into a string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a " -"normal character that will be decoded like any other." -msgstr "" - -#: ../../library/codecs.rst:1006 +"respectively. Their disadvantage is that if, for example, you use ``UTF-32-" +"BE`` on a little endian machine you will always have to swap bytes on " +"encoding and decoding. Python's ``UTF-16`` and ``UTF-32`` codecs avoid this " +"problem by using the platform's native byte order when no BOM is present. " +"Python follows prevailing platform practice, so native-endian data round-" +"trips without redundant byte swapping, even though the Unicode Standard " +"defaults to big-endian when the byte order is unspecified. When these bytes " +"are read by a CPU with a different endianness, the bytes have to be swapped. " +"To be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte " +"sequence, a BOM (\"Byte Order Mark\") is used. This is the Unicode character " +"``U+FEFF``. This character can be prepended to every ``UTF-16`` or " +"``UTF-32`` byte sequence. The byte swapped version of this character " +"(``0xFFFE``) is an illegal character that may not appear in a Unicode text. " +"When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is " +"``U+FFFE``, the bytes have to be swapped on decoding." +msgstr "" + +#: ../../library/codecs.rst:1001 +msgid "" +"Unfortunately the character ``U+FEFF`` had a second purpose as a ``ZERO " +"WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow a " +"word to be split. It can e.g. be used to give hints to a ligature algorithm. " +"With Unicode 4.0 using ``U+FEFF`` as a ``ZERO WIDTH NO-BREAK SPACE`` has " +"been deprecated (with ``U+2060`` (``WORD JOINER``) assuming this role). " +"Nevertheless Unicode software still must be able to handle ``U+FEFF`` in " +"both roles: as a BOM it's a device to determine the storage layout of the " +"encoded bytes, and vanishes once the byte sequence has been decoded into a " +"string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a normal character that will " +"be decoded like any other." +msgstr "" + +#: ../../library/codecs.rst:1011 msgid "" "There's another encoding that is able to encode the full range of Unicode " "characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " @@ -1257,59 +1262,59 @@ msgid "" "which when concatenated give the Unicode character):" msgstr "" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1020 msgid "Range" msgstr "" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1020 msgid "Encoding" msgstr "" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1022 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "``U-00000000`` ... ``U-0000007F``" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1022 msgid "0xxxxxxx" msgstr "0xxxxxxx" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1024 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "``U-00000080`` ... ``U-000007FF``" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1024 msgid "110xxxxx 10xxxxxx" msgstr "110xxxxx 10xxxxxx" -#: ../../library/codecs.rst:1021 +#: ../../library/codecs.rst:1026 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "``U-00000800`` ... ``U-0000FFFF``" -#: ../../library/codecs.rst:1021 +#: ../../library/codecs.rst:1026 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "1110xxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1023 +#: ../../library/codecs.rst:1028 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "``U-00010000`` ... ``U-0010FFFF``" -#: ../../library/codecs.rst:1023 +#: ../../library/codecs.rst:1028 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1026 +#: ../../library/codecs.rst:1031 msgid "" "The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -#: ../../library/codecs.rst:1028 +#: ../../library/codecs.rst:1033 msgid "" "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " "character in the decoded string (even if it's the first character) is " "treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" -#: ../../library/codecs.rst:1032 +#: ../../library/codecs.rst:1037 msgid "" "Without external information it's impossible to reliably determine which " "encoding was used for encoding a string. Each charmap encoding can decode " @@ -1335,7 +1340,7 @@ msgstr "" msgid "INVERTED QUESTION MARK" msgstr "" -#: ../../library/codecs.rst:1048 +#: ../../library/codecs.rst:1053 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1347,11 +1352,11 @@ msgid "" "the use of the BOM is discouraged and should generally be avoided." msgstr "" -#: ../../library/codecs.rst:1061 +#: ../../library/codecs.rst:1066 msgid "Standard Encodings" msgstr "標準編碼" -#: ../../library/codecs.rst:1063 +#: ../../library/codecs.rst:1068 msgid "" "Python comes with a number of codecs built-in, either implemented as C " "functions or with dictionaries as mapping tables. The following table lists " @@ -1364,20 +1369,20 @@ msgid "" "``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." msgstr "" -#: ../../library/codecs.rst:1075 +#: ../../library/codecs.rst:1080 msgid "" "The below table lists the most common aliases, for a complete list refer to " "the source :source:`aliases.py ` file." msgstr "" -#: ../../library/codecs.rst:1078 +#: ../../library/codecs.rst:1083 msgid "" "On Windows, ``cpXXX`` codecs are available for all code pages. But only " "codecs listed in the following table are guarantead to exist on other " "platforms." msgstr "" -#: ../../library/codecs.rst:1084 +#: ../../library/codecs.rst:1089 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1387,11 +1392,11 @@ msgid "" "Using alternative aliases for these encodings may result in slower execution." msgstr "" -#: ../../library/codecs.rst:1092 +#: ../../library/codecs.rst:1097 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -#: ../../library/codecs.rst:1095 +#: ../../library/codecs.rst:1100 msgid "" "Many of the character sets support the same languages. They vary in " "individual characters (e.g. whether the EURO SIGN is supported or not), and " @@ -1399,504 +1404,504 @@ msgid "" "languages in particular, the following variants typically exist:" msgstr "" -#: ../../library/codecs.rst:1100 +#: ../../library/codecs.rst:1105 msgid "an ISO 8859 codeset" msgstr "" -#: ../../library/codecs.rst:1102 +#: ../../library/codecs.rst:1107 msgid "" "a Microsoft Windows code page, which is typically derived from an 8859 " "codeset, but replaces control characters with additional graphic characters" msgstr "" -#: ../../library/codecs.rst:1105 +#: ../../library/codecs.rst:1110 msgid "an IBM EBCDIC code page" msgstr "" -#: ../../library/codecs.rst:1107 +#: ../../library/codecs.rst:1112 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Aliases" msgstr "" -#: ../../library/codecs.rst:1112 +#: ../../library/codecs.rst:1117 msgid "Languages" msgstr "語言" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1119 msgid "ascii" msgstr "ascii" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1119 msgid "646, us-ascii" msgstr "646, us-ascii" -#: ../../library/codecs.rst:1114 ../../library/codecs.rst:1120 -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1133 msgid "English" msgstr "英文" -#: ../../library/codecs.rst:1116 +#: ../../library/codecs.rst:1121 msgid "big5" msgstr "big5" -#: ../../library/codecs.rst:1116 +#: ../../library/codecs.rst:1121 msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" -#: ../../library/codecs.rst:1116 ../../library/codecs.rst:1118 -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1121 ../../library/codecs.rst:1123 +#: ../../library/codecs.rst:1182 msgid "Traditional Chinese" msgstr "繁體中文" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1123 msgid "big5hkscs" msgstr "big5hkscs" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1123 msgid "big5-hkscs, hkscs" msgstr "big5-hkscs, hkscs" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1125 msgid "cp037" msgstr "cp037" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1125 msgid "IBM037, IBM039" msgstr "IBM037, IBM039" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "cp273" msgstr "cp273" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "273, IBM273, csIBM273" msgstr "273, IBM273, csIBM273" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "German" msgstr "德文" -#: ../../library/codecs.rst:1126 +#: ../../library/codecs.rst:1131 msgid "cp424" msgstr "cp424" -#: ../../library/codecs.rst:1126 +#: ../../library/codecs.rst:1131 msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" -#: ../../library/codecs.rst:1126 ../../library/codecs.rst:1146 -#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1200 -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1131 ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1161 ../../library/codecs.rst:1205 +#: ../../library/codecs.rst:1268 msgid "Hebrew" msgstr "希伯來文" -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1133 msgid "cp437" msgstr "cp437" -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1133 msgid "437, IBM437" msgstr "437, IBM437" -#: ../../library/codecs.rst:1130 +#: ../../library/codecs.rst:1135 msgid "cp500" msgstr "cp500" -#: ../../library/codecs.rst:1130 +#: ../../library/codecs.rst:1135 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" -#: ../../library/codecs.rst:1130 ../../library/codecs.rst:1139 -#: ../../library/codecs.rst:1150 ../../library/codecs.rst:1187 -#: ../../library/codecs.rst:1194 ../../library/codecs.rst:1247 -#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1155 ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1280 ../../library/codecs.rst:1308 msgid "Western Europe" msgstr "" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1138 msgid "cp720" msgstr "cp720" -#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1160 -#: ../../library/codecs.rst:1202 ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1165 +#: ../../library/codecs.rst:1207 ../../library/codecs.rst:1264 msgid "Arabic" msgstr "阿拉伯文" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1140 msgid "cp737" msgstr "cp737" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1166 -#: ../../library/codecs.rst:1170 ../../library/codecs.rst:1196 -#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1140 ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1201 +#: ../../library/codecs.rst:1266 ../../library/codecs.rst:1301 msgid "Greek" msgstr "希臘文" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1142 msgid "cp775" msgstr "cp775" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1142 msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1137 ../../library/codecs.rst:1204 -#: ../../library/codecs.rst:1254 ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1142 ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1276 msgid "Baltic languages" msgstr "" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1144 msgid "cp850" msgstr "cp850" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1144 msgid "850, IBM850" msgstr "850, IBM850" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1146 msgid "cp852" msgstr "cp852" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1146 msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1141 ../../library/codecs.rst:1189 -#: ../../library/codecs.rst:1250 ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1255 ../../library/codecs.rst:1305 msgid "Central and Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1148 msgid "cp855" msgstr "cp855" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1148 msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1143 ../../library/codecs.rst:1191 -#: ../../library/codecs.rst:1256 ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1298 msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1151 msgid "cp856" msgstr "cp856" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1153 msgid "cp857" msgstr "cp857" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1153 msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1181 -#: ../../library/codecs.rst:1198 ../../library/codecs.rst:1265 -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1153 ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1203 ../../library/codecs.rst:1270 +#: ../../library/codecs.rst:1310 msgid "Turkish" msgstr "土耳其文" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1155 msgid "cp858" msgstr "cp858" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1155 msgid "858, IBM858" msgstr "858, IBM858" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "cp860" msgstr "cp860" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "860, IBM860" msgstr "860, IBM860" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "Portuguese" msgstr "" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1159 msgid "cp861" msgstr "cp861" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1159 msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1154 ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1159 ../../library/codecs.rst:1303 msgid "Icelandic" msgstr "" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1161 msgid "cp862" msgstr "cp862" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1161 msgid "862, IBM862" msgstr "862, IBM862" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "cp863" msgstr "cp863" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "863, IBM863" msgstr "863, IBM863" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "Canadian" msgstr "" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1165 msgid "cp864" msgstr "cp864" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1165 msgid "IBM864" msgstr "IBM864" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "cp865" msgstr "cp865" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "865, IBM865" msgstr "865, IBM865" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "Danish, Norwegian" msgstr "" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1169 msgid "cp866" msgstr "cp866" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1169 msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1169 ../../library/codecs.rst:1286 msgid "Russian" msgstr "俄羅斯文" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1171 msgid "cp869" msgstr "cp869" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1171 msgid "869, CP-GR, IBM869" msgstr "869, CP-GR, IBM869" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1173 msgid "cp874" msgstr "cp874" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1173 msgid "Thai" msgstr "泰文" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1175 msgid "cp875" msgstr "cp875" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1177 msgid "cp932" msgstr "cp932" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1177 msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "932, ms932, mskanji, ms-kanji, windows-31j" -#: ../../library/codecs.rst:1172 ../../library/codecs.rst:1208 -#: ../../library/codecs.rst:1210 ../../library/codecs.rst:1212 -#: ../../library/codecs.rst:1229 ../../library/codecs.rst:1232 -#: ../../library/codecs.rst:1237 ../../library/codecs.rst:1240 -#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1310 -#: ../../library/codecs.rst:1313 ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1177 ../../library/codecs.rst:1213 +#: ../../library/codecs.rst:1215 ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1234 ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1247 ../../library/codecs.rst:1315 +#: ../../library/codecs.rst:1318 ../../library/codecs.rst:1321 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1180 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1180 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1214 -#: ../../library/codecs.rst:1244 ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1180 ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1249 ../../library/codecs.rst:1284 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1182 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1182 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1184 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1184 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1186 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1186 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1188 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1188 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1183 ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1188 ../../library/codecs.rst:1292 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1192 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1192 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1194 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1194 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1196 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1196 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1199 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1199 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1201 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1201 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1203 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1203 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1205 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1205 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1207 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1207 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1209 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1209 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1213 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1213 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1215 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1215 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1217 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1217 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1219 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1219 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1223 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1223 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1904,450 +1909,454 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1218 ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1232 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1228 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1228 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1228 ../../library/codecs.rst:1230 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1230 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1230 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1232 msgid "hz" msgstr "hz" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1232 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1234 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1234 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1237 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1237 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1240 +#: ../../library/codecs.rst:1245 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1240 +#: ../../library/codecs.rst:1245 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1247 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1247 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1249 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1249 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1247 +#: ../../library/codecs.rst:1252 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1247 +#: ../../library/codecs.rst:1252 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1255 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1255 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1254 +#: ../../library/codecs.rst:1259 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1254 +#: ../../library/codecs.rst:1259 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1256 +#: ../../library/codecs.rst:1259 +msgid "Northern Europe" +msgstr "" + +#: ../../library/codecs.rst:1261 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1256 +#: ../../library/codecs.rst:1261 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1264 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1264 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1266 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1266 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1268 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1268 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1270 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1270 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "Thai languages" msgstr "泰語" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1276 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1276 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1280 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1280 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1284 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1284 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1286 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1288 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1288 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1292 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1294 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1294 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1289 ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1294 ../../library/codecs.rst:1312 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1298 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1298 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1301 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1301 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1303 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1303 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1305 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1305 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1308 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1308 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1310 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1310 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1312 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1312 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1310 +#: ../../library/codecs.rst:1315 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1310 +#: ../../library/codecs.rst:1315 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1318 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1318 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1321 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1321 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1324 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1324 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1319 ../../library/codecs.rst:1321 -#: ../../library/codecs.rst:1323 ../../library/codecs.rst:1325 -#: ../../library/codecs.rst:1327 ../../library/codecs.rst:1329 -#: ../../library/codecs.rst:1331 ../../library/codecs.rst:1333 -#: ../../library/codecs.rst:1335 +#: ../../library/codecs.rst:1324 ../../library/codecs.rst:1326 +#: ../../library/codecs.rst:1328 ../../library/codecs.rst:1330 +#: ../../library/codecs.rst:1332 ../../library/codecs.rst:1334 +#: ../../library/codecs.rst:1336 ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1340 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1326 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1326 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1328 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1328 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1330 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1330 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1332 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1332 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1329 +#: ../../library/codecs.rst:1334 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1329 +#: ../../library/codecs.rst:1334 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1336 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1336 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1333 +#: ../../library/codecs.rst:1338 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1333 +#: ../../library/codecs.rst:1338 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1335 +#: ../../library/codecs.rst:1340 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1343 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1344 +#: ../../library/codecs.rst:1349 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "``cp65001`` 現在是 ``utf_8`` 的別名。" -#: ../../library/codecs.rst:1347 +#: ../../library/codecs.rst:1352 msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." msgstr "" -#: ../../library/codecs.rst:1352 +#: ../../library/codecs.rst:1357 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1359 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2357,279 +2366,316 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1362 +#: ../../library/codecs.rst:1367 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1369 msgid "" -"The following codecs provide :class:`str` to :class:`bytes` encoding " -"and :term:`bytes-like object` to :class:`str` decoding, similar to the " -"Unicode text encodings." +"The following codecs provide :class:`str` to :class:`bytes` encoding and :" +"term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " +"text encodings." msgstr "" -#: ../../library/codecs.rst:1373 +#: ../../library/codecs.rst:1378 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1373 +#: ../../library/codecs.rst:1378 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1383 +#: ../../library/codecs.rst:1388 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1383 +#: ../../library/codecs.rst:1388 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1394 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1394 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1391 +#: ../../library/codecs.rst:1396 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1391 +#: ../../library/codecs.rst:1396 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1395 +#: ../../library/codecs.rst:1400 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1395 +#: ../../library/codecs.rst:1400 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1410 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1410 msgid "This Codec should only be used for testing purposes." msgstr "" -#: ../../library/codecs.rst:1409 +#: ../../library/codecs.rst:1414 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1419 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1419 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1426 +#: ../../library/codecs.rst:1431 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1433 +#: ../../library/codecs.rst:1438 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1435 +#: ../../library/codecs.rst:1440 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1443 +#: ../../library/codecs.rst:1448 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1450 +#: ../../library/codecs.rst:1455 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1475 +#: ../../library/codecs.rst:1480 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1479 +#: ../../library/codecs.rst:1484 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1482 +#: ../../library/codecs.rst:1487 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1489 +#: ../../library/codecs.rst:1494 +msgid "Standalone Codec Functions" +msgstr "" + +#: ../../library/codecs.rst:1496 +msgid "" +"The following functions provide encoding and decoding functionality similar " +"to codecs, but are not available as named codecs through :func:`codecs." +"encode` or :func:`codecs.decode`. They are used internally (for example, by :" +"mod:`pickle`) and behave similarly to the ``string_escape`` codec that was " +"removed in Python 3." +msgstr "" + +#: ../../library/codecs.rst:1503 +msgid "" +"Encode *input* using escape sequences. Similar to how :func:`repr` on bytes " +"produces escaped byte values." +msgstr "" + +#: ../../library/codecs.rst:1506 +msgid "*input* must be a :class:`bytes` object." +msgstr "" + +#: ../../library/codecs.rst:1508 ../../library/codecs.rst:1517 +msgid "" +"Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` " +"object and *length* is the number of bytes consumed." +msgstr "" + +#: ../../library/codecs.rst:1513 +msgid "Decode *input* from escape sequences back to the original bytes." +msgstr "" + +#: ../../library/codecs.rst:1515 +msgid "*input* must be a :term:`bytes-like object`." +msgstr "*input* 必須是個 :term:`bytes-like object`。" + +#: ../../library/codecs.rst:1524 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1491 +#: ../../library/codecs.rst:1526 msgid "" -"The following codec provides a text transform: a :class:`str` " -"to :class:`str` mapping. It is not supported by :meth:`str.encode` (which " -"only produces :class:`bytes` output)." +"The following codec provides a text transform: a :class:`str` to :class:" +"`str` mapping. It is not supported by :meth:`str.encode` (which only " +"produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1505 +#: ../../library/codecs.rst:1540 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1508 +#: ../../library/codecs.rst:1543 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1513 +#: ../../library/codecs.rst:1548 msgid ":mod:`encodings` --- Encodings package" msgstr "" -#: ../../library/codecs.rst:1518 +#: ../../library/codecs.rst:1553 msgid "This module implements the following functions:" msgstr "" -#: ../../library/codecs.rst:1522 +#: ../../library/codecs.rst:1557 msgid "Normalize encoding name *encoding*." msgstr "" -#: ../../library/codecs.rst:1524 +#: ../../library/codecs.rst:1559 msgid "" "Normalization works as follows: all non-alphanumeric characters except the " "dot used for Python package names are collapsed and replaced with a single " @@ -2637,67 +2683,67 @@ msgid "" "-;#'`` becomes ``'_'``." msgstr "" -#: ../../library/codecs.rst:1529 +#: ../../library/codecs.rst:1564 msgid "Note that *encoding* should be ASCII only." msgstr "" -#: ../../library/codecs.rst:1533 +#: ../../library/codecs.rst:1568 msgid "" "The following functions should not be used directly, except for testing " "purposes; :func:`codecs.lookup` should be used instead." msgstr "" -#: ../../library/codecs.rst:1539 +#: ../../library/codecs.rst:1574 msgid "" "Search for the codec module corresponding to the given encoding name " "*encoding*." msgstr "" -#: ../../library/codecs.rst:1542 +#: ../../library/codecs.rst:1577 msgid "" -"This function first normalizes the *encoding* " -"using :func:`normalize_encoding`, then looks for a corresponding alias. It " -"attempts to import a codec module from the encodings package using either " -"the alias or the normalized name. If the module is found and defines a valid " +"This function first normalizes the *encoding* using :func:" +"`normalize_encoding`, then looks for a corresponding alias. It attempts to " +"import a codec module from the encodings package using either the alias or " +"the normalized name. If the module is found and defines a valid " "``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, " "the codec is cached and returned." msgstr "" -#: ../../library/codecs.rst:1549 +#: ../../library/codecs.rst:1584 msgid "" "If the codec module defines a ``getaliases()`` function any returned aliases " "are registered for future use." msgstr "" -#: ../../library/codecs.rst:1555 +#: ../../library/codecs.rst:1590 msgid "" "Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." msgstr "" -#: ../../library/codecs.rst:1557 +#: ../../library/codecs.rst:1592 msgid "" "If the code page is valid and supported, return a :class:`codecs.CodecInfo` " "object for it." msgstr "" -#: ../../library/codecs.rst:1560 ../../library/codecs.rst:1646 +#: ../../library/codecs.rst:1595 ../../library/codecs.rst:1681 msgid "Availability" msgstr "可用性" -#: ../../library/codecs.rst:1565 +#: ../../library/codecs.rst:1600 msgid "This module implements the following exception:" msgstr "" -#: ../../library/codecs.rst:1569 +#: ../../library/codecs.rst:1604 msgid "Raised when a codec is invalid or incompatible." msgstr "" -#: ../../library/codecs.rst:1573 +#: ../../library/codecs.rst:1608 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1579 +#: ../../library/codecs.rst:1614 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2705,27 +2751,27 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1584 +#: ../../library/codecs.rst:1619 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" -#: ../../library/codecs.rst:1587 +#: ../../library/codecs.rst:1622 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " -"domain names. A domain name containing non-ASCII characters (such as " -"``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding " -"(ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the " -"domain name is then used in all places where arbitrary characters are not " -"allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` " -"fields, and so on. This conversion is carried out in the application; if " -"possible invisible to the user: The application should transparently convert " -"Unicode domain labels to IDNA on the wire, and convert back ACE labels to " -"Unicode before presenting them to the user." +"domain names. A domain name containing non-ASCII characters (such as ``www." +"Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding (ACE, " +"such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the domain " +"name is then used in all places where arbitrary characters are not allowed " +"by the protocol, such as DNS queries, HTTP :mailheader:`Host` fields, and so " +"on. This conversion is carried out in the application; if possible invisible " +"to the user: The application should transparently convert Unicode domain " +"labels to IDNA on the wire, and convert back ACE labels to Unicode before " +"presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1598 +#: ../../library/codecs.rst:1633 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2736,20 +2782,20 @@ msgid "" "the :mod:`socket` module transparently converts Unicode host names to ACE, " "so that applications need not be concerned about converting host names " "themselves when they pass them to the socket module. On top of that, modules " -"that have host names as function parameters, such as :mod:`http.client` " -"and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " +"that have host names as function parameters, such as :mod:`http.client` and :" +"mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " "transparently sends an IDNA hostname in the :mailheader:`Host` field if it " "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1611 +#: ../../library/codecs.rst:1646 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1615 +#: ../../library/codecs.rst:1650 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2757,45 +2803,45 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1623 +#: ../../library/codecs.rst:1658 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1629 +#: ../../library/codecs.rst:1664 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1635 +#: ../../library/codecs.rst:1670 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1639 +#: ../../library/codecs.rst:1674 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr ":mod:`encodings.mbcs` --- Windows ANSI 碼頁" -#: ../../library/codecs.rst:1644 +#: ../../library/codecs.rst:1679 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "這個模組實作了 ANSI 碼頁 (CP_ACP)。" -#: ../../library/codecs.rst:1648 +#: ../../library/codecs.rst:1683 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1652 +#: ../../library/codecs.rst:1687 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1657 +#: ../../library/codecs.rst:1692 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1663 +#: ../../library/codecs.rst:1698 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " diff --git a/library/collections.abc.po b/library/collections.abc.po index 9cd5830693..b999edb5cc 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-08 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-" @@ -23,7 +23,7 @@ msgstr ":mod:`!collections.abc` --- 容器的抽象基底類別" #: ../../library/collections.abc.rst:10 msgid "Formerly, this module was part of the :mod:`collections` module." -msgstr "" +msgstr "過去此模組是 :mod:`collections` 模組的一部分。" #: ../../library/collections.abc.rst:13 msgid "**Source code:** :source:`Lib/_collections_abc.py`" @@ -309,6 +309,8 @@ msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" +"繼承 :class:`Sequence` 方法和 ``append``、``clear``、``reverse``、``extend``、" +"``pop``、``remove`` 和 ``__iadd__``" #: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" @@ -506,23 +508,23 @@ msgstr "" #: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" -msgstr "" +msgstr "集合抽象基底類別的詳細描述" #: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__contains__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__hash__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__len__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__call__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:219 msgid "" @@ -532,7 +534,7 @@ msgstr "" #: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." -msgstr "" +msgstr "有提供 :meth:`~container.__iter__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:226 msgid "" @@ -552,12 +554,15 @@ msgid "" "ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" "`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" +"有提供 :meth:`~iterator.__iter__` 和 :meth:`~iterator.__next__` 方法之類別的 ABC。" +"另請參閱 :term:`iterator` 的定義。" #: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" +"亦有提供 :meth:`~object.__reversed__` 方法之可疊代類別的 ABC。" #: ../../library/collections.abc.rst:254 msgid "" @@ -575,7 +580,7 @@ msgstr "" #: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." -msgstr "" +msgstr "唯讀且可變\\ :term:`序列 `\\ 的 ABC。" #: ../../library/collections.abc.rst:270 msgid "" @@ -590,16 +595,16 @@ msgstr "" #: ../../library/collections.abc.rst:282 msgid "Return first index of *value*." -msgstr "" +msgstr "回傳 *value* 的第一個索引。" #: ../../library/collections.abc.rst:284 msgid "Raises :exc:`ValueError` if the value is not present." -msgstr "" +msgstr "如果找不到該值,則引發 :exc:`ValueError`。" #: ../../library/collections.abc.rst:286 msgid "" "Supporting the *start* and *stop* arguments is optional, but recommended." -msgstr "" +msgstr "建議要支援 *start* 和 *stop* 引數,但並非必要。" #: ../../library/collections.abc.rst:288 msgid "" @@ -608,49 +613,73 @@ msgid "" msgstr "" #: ../../library/collections.abc.rst:292 +msgid "The :class:`ByteString` ABC has been deprecated." +msgstr ":class:`ByteString` ABC 已被棄用。" + +#: ../../library/collections.abc.rst:295 msgid "" -"The :class:`ByteString` ABC has been deprecated. For use in type " -"annotations, prefer a union, like ``bytes | bytearray``, or :class:" -"`collections.abc.Buffer`. For use as an ABC, prefer :class:`Sequence` or :" -"class:`collections.abc.Buffer`." +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`Buffer` or a union that explicitly " +"specifies the types your code supports (e.g., ``bytes | bytearray | " +"memoryview``)." msgstr "" #: ../../library/collections.abc.rst:301 -msgid "ABCs for read-only and mutable :ref:`sets `." +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../library/collections.abc.rst:309 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." +msgstr "更多詳細資訊請參閱 :pep:`PEP 688 <688#current-options>`。" -#: ../../library/collections.abc.rst:306 +#: ../../library/collections.abc.rst:314 +msgid "ABCs for read-only and mutable :ref:`sets `." +msgstr "唯讀且可變\\ :ref:`集合 `\\ 的 ABC。" + +#: ../../library/collections.abc.rst:319 msgid "ABCs for read-only and mutable :term:`mappings `." -msgstr "" +msgstr "唯讀且可變\\ :term:`對映 `\\ 的 ABC。" -#: ../../library/collections.abc.rst:313 +#: ../../library/collections.abc.rst:326 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:317 +#: ../../library/collections.abc.rst:330 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " "expressions. Custom implementations must provide the :meth:`~object." "__await__` method." msgstr "" -#: ../../library/collections.abc.rst:321 +#: ../../library/collections.abc.rst:334 msgid "" ":term:`Coroutine ` objects and instances of the :class:" "`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:325 +#: ../../library/collections.abc.rst:338 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." +"decorated with :deco:`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." msgstr "" -#: ../../library/collections.abc.rst:335 +#: ../../library/collections.abc.rst:348 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " "methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" @@ -659,63 +688,63 @@ msgid "" "instances are also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:343 +#: ../../library/collections.abc.rst:356 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." +"decorated with :deco:`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." msgstr "" -#: ../../library/collections.abc.rst:349 +#: ../../library/collections.abc.rst:362 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`." msgstr "" -#: ../../library/collections.abc.rst:358 +#: ../../library/collections.abc.rst:371 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:365 +#: ../../library/collections.abc.rst:378 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:372 +#: ../../library/collections.abc.rst:385 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:375 +#: ../../library/collections.abc.rst:388 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:382 +#: ../../library/collections.abc.rst:395 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:388 +#: ../../library/collections.abc.rst:401 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:390 +#: ../../library/collections.abc.rst:403 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:393 +#: ../../library/collections.abc.rst:406 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -725,7 +754,7 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:397 +#: ../../library/collections.abc.rst:410 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 " @@ -735,7 +764,7 @@ msgid "" "methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:404 +#: ../../library/collections.abc.rst:417 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -761,11 +790,11 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:426 +#: ../../library/collections.abc.rst:439 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:429 +#: ../../library/collections.abc.rst:442 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 " @@ -778,14 +807,14 @@ msgid "" "iterable argument." msgstr "" -#: ../../library/collections.abc.rst:440 +#: ../../library/collections.abc.rst:453 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:446 +#: ../../library/collections.abc.rst:459 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 " @@ -794,12 +823,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:454 +#: ../../library/collections.abc.rst:467 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:457 +#: ../../library/collections.abc.rst:470 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 637cf57e01..786f7b046d 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1574,6 +1574,13 @@ msgid "" ">>> Pixel(11, 22, 128, 255, 0)\n" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" +">>> p._fields # 查看欄位名稱\n" +"('x', 'y')\n" +"\n" +">>> Color = namedtuple('Color', 'red green blue')\n" +">>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)\n" +">>> Pixel(11, 22, 128, 255, 0)\n" +"Pixel(x=11, y=22, red=128, green=255, blue=0)" #: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." diff --git a/library/compression.po b/library/compression.po index 8bedbc98d6..db9321737a 100644 --- a/library/compression.po +++ b/library/compression.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-05 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" msgid "The :mod:`!compression` package" msgstr ":mod:`!compression` 套件" -#: ../../library/compression.rst:6 +#: ../../library/compression.rst:8 msgid "" "The :mod:`!compression` package contains the canonical compression modules " "containing interfaces to several different compression algorithms. Some of " @@ -29,24 +29,27 @@ msgid "" "reasons, and will not be removed without a deprecation cycle. The use of " "modules in :mod:`!compression` is encouraged where practical." msgstr "" +":mod:`!compression` 套件包含了有多種不同壓縮演算法介面的標準壓縮模組。其中一些模組過去" +"是以獨立模組的形式提供;為了相容性考量,這些模組將繼續以其原始名稱提供,並且不會在沒有經過" +"棄用週期的情況下被移除。建議在可行的情況下盡量先使用 :mod:`!compression` 中的模組。" -#: ../../library/compression.rst:13 +#: ../../library/compression.rst:15 msgid ":mod:`!compression.bz2` -- Re-exports :mod:`bz2`" -msgstr "" +msgstr ":mod:`!compression.bz2` -- 重新匯出 :mod:`bz2`" -#: ../../library/compression.rst:14 +#: ../../library/compression.rst:16 msgid ":mod:`!compression.gzip` -- Re-exports :mod:`gzip`" -msgstr "" +msgstr ":mod:`!compression.gzip` -- 重新匯出 :mod:`gzip`" -#: ../../library/compression.rst:15 +#: ../../library/compression.rst:17 msgid ":mod:`!compression.lzma` -- Re-exports :mod:`lzma`" -msgstr "" +msgstr ":mod:`!compression.lzma` -- 重新匯出 :mod:`lzma`" -#: ../../library/compression.rst:16 +#: ../../library/compression.rst:18 msgid ":mod:`!compression.zlib` -- Re-exports :mod:`zlib`" -msgstr "" +msgstr ":mod:`!compression.zlib` -- 重新匯出 :mod:`zlib`" -#: ../../library/compression.rst:17 +#: ../../library/compression.rst:19 msgid "" ":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" -msgstr "" +msgstr ":mod:`compression.zstd` -- Zstandard 壓縮函式庫的包裝器" diff --git a/library/crypt.po b/library/crypt.po index b8cf2e9438..07db5a7c63 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-10 00:15+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-" @@ -34,12 +34,12 @@ msgstr "" msgid "" "Applications can use the :mod:`hashlib` module from the standard library. " "Other possible replacements are third-party libraries from PyPI: :pypi:" -"`legacycrypt`, :pypi:`bcrypt`, :pypi:`argon2-cffi`, or :pypi:`passlib`. " -"These are not supported or maintained by the Python core team." +"`legacycrypt`, :pypi:`bcrypt`, or :pypi:`argon2-cffi`. These are not " +"supported or maintained by the Python core team." msgstr "" "應用程式可以改用標準函式庫中的 :mod:`hashlib` 模組。其他可能的替代方案是 " -"PyPI 上的第三方庫::pypi:`legacycrypt`、:pypi:`bcrypt`、:pypi:`argon2-cffi` " -"或 :pypi:`passlib`。這些函式庫並不受 Python 核心團隊支援或維護。" +"PyPI 上的第三方庫::pypi:`legacycrypt`、:pypi:`bcrypt` 或 :pypi:`argon2-cffi`" +"。這些函式庫並不受 Python 核心團隊支援或維護。" #: ../../library/crypt.rst:19 msgid "" diff --git a/library/csv.po b/library/csv.po index 300da9c590..377a9de593 100644 --- a/library/csv.po +++ b/library/csv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-09 00:15+0000\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,8 +122,8 @@ msgstr "" "`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉換成浮點" "數),否則不會進行自動資料型別轉換。" -#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:181 -#: ../../library/csv.rst:219 +#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:182 +#: ../../library/csv.rst:220 msgid "A short usage example::" msgstr "一個簡短的用法範例: ::" @@ -228,7 +228,7 @@ msgstr "" msgid "Return the names of all registered dialects." msgstr "回傳所有已註冊的 dialect 名稱。" -#: ../../library/csv.rst:144 +#: ../../library/csv.rst:145 msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." @@ -236,11 +236,11 @@ msgstr "" "回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" -#: ../../library/csv.rst:148 +#: ../../library/csv.rst:149 msgid "The :mod:`csv` module defines the following classes:" msgstr ":mod:`csv` 模組定義了下列的類別:" -#: ../../library/csv.rst:153 +#: ../../library/csv.rst:154 msgid "" "Create an object that operates like a regular reader but maps the " "information in each row to a :class:`dict` whose keys are given by the " @@ -249,7 +249,7 @@ msgstr "" "建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) 到 :" "class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" -#: ../../library/csv.rst:157 +#: ../../library/csv.rst:158 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " @@ -263,7 +263,7 @@ msgstr "" "供,它們就會被使用,且第一列會被包含在結果中。不管欄位標題是如何決定的," "dictionary 都會保留原始的排序。" -#: ../../library/csv.rst:164 +#: ../../library/csv.rst:165 msgid "" "If a row has more fields than fieldnames, the remaining data is put in a " "list and stored with the fieldname specified by *restkey* (which defaults to " @@ -275,28 +275,28 @@ msgstr "" "``None``)特指的欄位標題會放入列表當中並儲存。如果一個非空的 (non-blank) 列中" "的欄位比欄位標題還少,缺少的值則會填入 *restval* (預設為 ``None``)的值。" -#: ../../library/csv.rst:170 +#: ../../library/csv.rst:171 msgid "" "All other optional or keyword arguments are passed to the underlying :class:" "`reader` instance." msgstr "所有其他選填的引數或關鍵字引數皆會傳遞至下層的 :class:`reader` 實例。" -#: ../../library/csv.rst:173 ../../library/csv.rst:217 +#: ../../library/csv.rst:174 ../../library/csv.rst:218 msgid "" "If the argument passed to *fieldnames* is an iterator, it will be coerced to " "a :class:`list`." msgstr "" "如果傳遞至 *fieldnames* 的引數是個疊代器,則會被迫成為一個 :class:`list`。" -#: ../../library/csv.rst:175 +#: ../../library/csv.rst:176 msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "回傳的列已成為型別 :class:`OrderedDict`。" -#: ../../library/csv.rst:178 +#: ../../library/csv.rst:179 msgid "Returned rows are now of type :class:`dict`." msgstr "回傳的列已成為型別 :class:`dict`。" -#: ../../library/csv.rst:183 +#: ../../library/csv.rst:184 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -322,7 +322,7 @@ msgstr "" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" -#: ../../library/csv.rst:199 +#: ../../library/csv.rst:200 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -347,7 +347,7 @@ msgstr "" "被設定為 ``'ignore'``,dictionary 中額外的值會被忽略。其他選填的引數或關鍵字" "引數皆會傳遞至下層的 :class:`writer` 實例。" -#: ../../library/csv.rst:214 +#: ../../library/csv.rst:215 msgid "" "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " "of the :class:`DictWriter` class is not optional." @@ -355,7 +355,7 @@ msgstr "" "請記得這不像類別 :class:`DictReader`,在類別 :class:`DictWriter` 中,參數 " "*fieldnames* 並不是選填的。" -#: ../../library/csv.rst:221 +#: ../../library/csv.rst:222 msgid "" "import csv\n" "\n" @@ -379,7 +379,7 @@ msgstr "" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" -#: ../../library/csv.rst:235 +#: ../../library/csv.rst:236 msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " @@ -392,7 +392,7 @@ msgstr "" "巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以及 :class:" "`writer` 的實例該如何表示。" -#: ../../library/csv.rst:241 +#: ../../library/csv.rst:242 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " @@ -402,7 +402,7 @@ msgstr "" "透過特定 :class:`reader` 及 :class:`writer` 類別的初始器 (initializer, " "``__init__``) 函式進行註冊,就像這樣: ::" -#: ../../library/csv.rst:245 +#: ../../library/csv.rst:246 msgid "" "import csv\n" "\n" @@ -414,7 +414,7 @@ msgstr "" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" -#: ../../library/csv.rst:253 +#: ../../library/csv.rst:254 msgid "" "The :class:`excel` class defines the usual properties of an Excel-generated " "CSV file. It is registered with the dialect name ``'excel'``." @@ -422,7 +422,7 @@ msgstr "" "類別 :class:`excel` 定義了透過 Excel 產生的 CSV 檔案的慣用屬性。它被註冊的 " "dialect 名稱為 ``'excel'``。" -#: ../../library/csv.rst:259 +#: ../../library/csv.rst:260 msgid "" "The :class:`excel_tab` class defines the usual properties of an Excel-" "generated TAB-delimited file. It is registered with the dialect name " @@ -431,7 +431,7 @@ msgstr "" "類別 :class:`excel_tab` 定義了透過 Excel 產生並以 Tab 作為分隔的 CSV 檔案的慣" "用屬性。它被註冊的 dialect 名稱為 ``'excel-tab'``。" -#: ../../library/csv.rst:265 +#: ../../library/csv.rst:266 msgid "" "The :class:`unix_dialect` class defines the usual properties of a CSV file " "generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " @@ -441,15 +441,15 @@ msgstr "" "句話說,使用 ``'\\n'`` 作為換行符號且所有欄位都被引號包覆起來。它被註冊的 " "dialect 名稱為 ``'unix'``。" -#: ../../library/csv.rst:274 +#: ../../library/csv.rst:275 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "類別 :class:`Sniffer` 被用來推斷 CSV 檔案的格式。" -#: ../../library/csv.rst:276 +#: ../../library/csv.rst:277 msgid "The :class:`Sniffer` class provides two methods:" msgstr "類別 :class:`Sniffer` 提供了兩個 method:" -#: ../../library/csv.rst:280 +#: ../../library/csv.rst:281 msgid "" "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " "the parameters found. If the optional *delimiters* parameter is given, it " @@ -459,7 +459,7 @@ msgstr "" "數。如果給定選填的參數 *delimiters*,它會被解釋為一個字串且含有可能、有效的分" "隔字元。" -#: ../../library/csv.rst:288 +#: ../../library/csv.rst:289 msgid "" "Analyze the sample text (presumed to be in CSV format) and return :const:" "`True` if the first row appears to be a series of column headers. Inspecting " @@ -470,18 +470,18 @@ msgstr "" "格式)並回傳 :const:`True`。檢查每一欄時,會考慮是否滿足兩個關鍵標準其中之" "一,判斷 sample 是否包含標題:" -#: ../../library/csv.rst:293 +#: ../../library/csv.rst:294 msgid "the second through n-th rows contain numeric values" msgstr "第二列至第 n 列包含數字" -#: ../../library/csv.rst:294 +#: ../../library/csv.rst:295 msgid "" "the second through n-th rows contain strings where at least one value's " "length differs from that of the putative header of that column." msgstr "" "第二列到第 n 列包含的字串中至少有一個值的長度與該行的假定標題的長度不同。" -#: ../../library/csv.rst:297 +#: ../../library/csv.rst:298 msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." @@ -489,7 +489,7 @@ msgstr "" "對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" "`True`。" -#: ../../library/csv.rst:302 +#: ../../library/csv.rst:303 msgid "" "This method is a rough heuristic and may produce both false positives and " "negatives." @@ -497,11 +497,11 @@ msgstr "" "此方法是一個粗略的啟發,可能會產生偽陽性及偽陰性 (false positives and " "negatives)。" -#: ../../library/csv.rst:305 +#: ../../library/csv.rst:306 msgid "An example for :class:`Sniffer` use::" msgstr "一個 :class:`Sniffer` 的使用範例: ::" -#: ../../library/csv.rst:307 +#: ../../library/csv.rst:308 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -515,15 +515,15 @@ msgstr "" " reader = csv.reader(csvfile, dialect)\n" " # ... 在這邊處理 CSV 檔案 ..." -#: ../../library/csv.rst:316 +#: ../../library/csv.rst:317 msgid "The :mod:`csv` module defines the following constants:" msgstr ":mod:`csv` 模組定義了以下常數:" -#: ../../library/csv.rst:320 +#: ../../library/csv.rst:321 msgid "Instructs :class:`writer` objects to quote all fields." msgstr "引導 :class:`writer` 物件引用所有欄位。" -#: ../../library/csv.rst:325 +#: ../../library/csv.rst:326 msgid "" "Instructs :class:`writer` objects to only quote those fields which contain " "special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " @@ -532,17 +532,17 @@ msgstr "" "引導 :class:`writer` 物件只引用包含特殊字元的欄位,例如:*delimiter*、" "*quotechar*、``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元。" -#: ../../library/csv.rst:332 +#: ../../library/csv.rst:333 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "引導 :class:`writer` 物件引用所有非數字的欄位。" -#: ../../library/csv.rst:334 +#: ../../library/csv.rst:335 msgid "" "Instructs :class:`reader` objects to convert all non-quoted fields to type :" "class:`float`." msgstr "引導 :class:`reader` 物件轉換所有非引用的欄位為 :class:`float`。" -#: ../../library/csv.rst:337 +#: ../../library/csv.rst:338 msgid "" "Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" "class:`~enum.IntEnum`, have a string representation that cannot be converted " @@ -550,7 +550,7 @@ msgid "" "data:`QUOTE_STRINGS` modes." msgstr "" -#: ../../library/csv.rst:345 +#: ../../library/csv.rst:346 msgid "" "Instructs :class:`writer` objects to never quote fields. When the current " "*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " @@ -564,13 +564,13 @@ msgstr "" "前的字元是目前的 *escapechar*。如果沒有設定 *escapechar*,若遇到任何字元需要" "逸出,寫入器則會引發 :exc:`Error`。設定 *quotechar* 為 ``None`` 以防止逸出。" -#: ../../library/csv.rst:353 +#: ../../library/csv.rst:354 msgid "" "Instructs :class:`reader` objects to perform no special processing of quote " "characters." msgstr "引導 :class:`reader` 物件不對引號進行特別處理。" -#: ../../library/csv.rst:357 +#: ../../library/csv.rst:358 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " @@ -579,7 +579,7 @@ msgstr "" "引導 :class:`writer` 物件引用所有非 ``None`` 的欄位。這與 :data:`QUOTE_ALL` " "相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引號)字串。" -#: ../../library/csv.rst:361 +#: ../../library/csv.rst:362 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " "``None`` and to otherwise behave as :data:`QUOTE_ALL`." @@ -587,7 +587,7 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)欄位直譯 (interpret) 為 ``None``,否" "則會和 :data:`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:368 +#: ../../library/csv.rst:369 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " @@ -597,7 +597,7 @@ msgstr "" "`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引" "號)字串。" -#: ../../library/csv.rst:372 +#: ../../library/csv.rst:373 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." @@ -605,19 +605,19 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會和 :data:" "`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:377 +#: ../../library/csv.rst:378 msgid "The :mod:`csv` module defines the following exception:" msgstr ":mod:`csv` 模組定義下列例外:" -#: ../../library/csv.rst:382 +#: ../../library/csv.rst:383 msgid "Raised by any of the functions when an error is detected." msgstr "當偵測到錯誤時,任何函式都可以引發。" -#: ../../library/csv.rst:387 +#: ../../library/csv.rst:388 msgid "Dialects and Formatting Parameters" msgstr "Dialect 與格式參數" -#: ../../library/csv.rst:389 +#: ../../library/csv.rst:390 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " @@ -636,16 +636,16 @@ msgstr "" "代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其與 :class:" "`Dialect` 類別定義的屬性具有相同的名字。" -#: ../../library/csv.rst:399 +#: ../../library/csv.rst:400 msgid "Dialects support the following attributes:" msgstr "Dialect 支援下列屬性:" -#: ../../library/csv.rst:404 +#: ../../library/csv.rst:405 msgid "" "A one-character string used to separate fields. It defaults to ``','``." msgstr "一個單一字元 (one-character) 的字串可已用來分割欄位。預設為 ``','``。" -#: ../../library/csv.rst:409 +#: ../../library/csv.rst:410 msgid "" "Controls how instances of *quotechar* appearing inside a field should " "themselves be quoted. When :const:`True`, the character is doubled. When :" @@ -656,7 +656,7 @@ msgstr "" "為 :const:`True`,字元會是雙引號。若為 :const:`False`,在 *quotechar* 之前會" "先使用 *escapechar* 作為前綴字。預設為 :const:`True`。" -#: ../../library/csv.rst:414 +#: ../../library/csv.rst:415 msgid "" "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" "exc:`Error` is raised if a *quotechar* is found in a field." @@ -664,28 +664,28 @@ msgstr "" "在輸出時,若 *doublequote* 是 :const:`False` 且\\ *逸出字元*\\ 沒有被設定,當" "一個\\ *引號*\\ 在欄位中被發現時,:exc:`Error` 會被引發。" -#: ../../library/csv.rst:420 +#: ../../library/csv.rst:421 msgid "" "A one-character string used by the writer to escape characters that require " "escaping:" msgstr "一個單一字元的字串,會被寫入器用來逸出需要逸出的字元:" -#: ../../library/csv.rst:423 +#: ../../library/csv.rst:424 msgid "" "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " "characters in *lineterminator* are escaped if *quoting* is set to :const:" "`QUOTE_NONE`;" msgstr "" -#: ../../library/csv.rst:426 +#: ../../library/csv.rst:427 msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "" -#: ../../library/csv.rst:427 +#: ../../library/csv.rst:428 msgid "the *escapechar* itself." msgstr "*escapechar* 本身。" -#: ../../library/csv.rst:429 +#: ../../library/csv.rst:430 msgid "" "On reading, the *escapechar* removes any special meaning from the following " "character. It defaults to :const:`None`, which disables escaping." @@ -693,17 +693,17 @@ msgstr "" "在讀取時,*escapechar* 會移除後面字元的任何特殊意義。預設為 :const:`None`,表" "示禁止逸出。" -#: ../../library/csv.rst:432 +#: ../../library/csv.rst:433 msgid "An empty *escapechar* is not allowed." msgstr "*escapechar* 為空是不被接受的。" -#: ../../library/csv.rst:437 +#: ../../library/csv.rst:438 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "由 :class:`writer` 產生被用來分行的字串。預設為 ``'\\r\\n'``。" -#: ../../library/csv.rst:442 +#: ../../library/csv.rst:443 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " @@ -712,7 +712,7 @@ msgstr "" ":class:`reader` 是 hard-coded 辨別 ``'\\r'`` or ``'\\n'`` 作為行尾 (end-of-" "line),並忽略\\ *lineterminator*。未來可能會改變這個行為。" -#: ../../library/csv.rst:449 +#: ../../library/csv.rst:450 msgid "" "A one-character string used to quote fields containing special characters, " "such as the *delimiter* or the *quotechar*, or which contain new-line " @@ -725,11 +725,11 @@ msgstr "" "元)。預設為 ``'\"'``。如果 *quoting* 設定為 :const:`QUOTE_NONE`,可以設定為 " "``None`` 以防止逸出 ``'\"'``。" -#: ../../library/csv.rst:456 +#: ../../library/csv.rst:457 msgid "An empty *quotechar* is not allowed." msgstr "*quotechar* 為空是不被允許的。" -#: ../../library/csv.rst:461 +#: ../../library/csv.rst:462 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :ref:`QUOTE_\\* constants `\\ 且預設為 :" "const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" -#: ../../library/csv.rst:469 +#: ../../library/csv.rst:470 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " "ignored. The default is :const:`False`. When combining ``delimiter=' '`` " "with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "" "若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設為 :const:" -"`False`。當結合 ``delimiter=' '`` 與 ``skipinitialspace=True`` 時,不允許沒有引號的空欄位。" +"`False`。當結合 ``delimiter=' '`` 與 ``skipinitialspace=True`` 時,不允許沒有" +"引號的空欄位。" -#: ../../library/csv.rst:476 +#: ../../library/csv.rst:477 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" "若為 ``True``,若有錯誤的 CSV 輸入則會引發 :exc:`Error`。預設為 ``False``。" -#: ../../library/csv.rst:482 +#: ../../library/csv.rst:483 msgid "Reader Objects" msgstr "讀取器物件" -#: ../../library/csv.rst:484 +#: ../../library/csv.rst:485 msgid "" "Reader objects (:class:`DictReader` instances and objects returned by the :" "func:`reader` function) have the following public methods:" @@ -768,7 +769,7 @@ msgstr "" "讀取器物件(:func:`reader` 函式回傳的 :class:`DictReader` 實例與物件)有下列" "公開方法 (public method):" -#: ../../library/csv.rst:489 +#: ../../library/csv.rst:490 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -779,25 +780,25 @@ msgstr "" "傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" "`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" -#: ../../library/csv.rst:495 +#: ../../library/csv.rst:496 msgid "Reader objects have the following public attributes:" msgstr "讀取器物件有下列公開屬性 (public attributes):" -#: ../../library/csv.rst:499 +#: ../../library/csv.rst:500 msgid "A read-only description of the dialect in use by the parser." msgstr "dialect 的唯讀敘述,會被剖析器使用。" -#: ../../library/csv.rst:504 +#: ../../library/csv.rst:505 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "來源疊代器所讀取的行數。這與回傳的紀錄數不同,因為可以進行跨行紀錄。" -#: ../../library/csv.rst:508 +#: ../../library/csv.rst:509 msgid "DictReader objects have the following public attribute:" msgstr "DictReader 物件有下列公開屬性:" -#: ../../library/csv.rst:512 +#: ../../library/csv.rst:513 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." @@ -805,11 +806,11 @@ msgstr "" "若在建立物件時沒有作為參數傳遞,這個屬性會在第一次存取之前或是第一筆資料被讀" "取之前進行初始化 (initialize)。" -#: ../../library/csv.rst:519 +#: ../../library/csv.rst:520 msgid "Writer Objects" msgstr "寫入器物件" -#: ../../library/csv.rst:521 +#: ../../library/csv.rst:522 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -827,7 +828,7 @@ msgstr "" "遞)。請注意,在寫入複數 (complex number) 時會用小括號 (parens) 包起來。這可" "能在其他程式讀取 CSV 檔案時導致某些問題(假設他們完全支援複雜數字)。" -#: ../../library/csv.rst:532 +#: ../../library/csv.rst:533 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " @@ -836,11 +837,11 @@ msgstr "" "將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" -#: ../../library/csv.rst:536 +#: ../../library/csv.rst:537 msgid "Added support of arbitrary iterables." msgstr "新增對任意可疊代物件 (arbitrary iterables) 的支援。" -#: ../../library/csv.rst:541 +#: ../../library/csv.rst:542 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " @@ -849,19 +850,19 @@ msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" "中,並依照目前的 dialect 進行格式化。" -#: ../../library/csv.rst:545 +#: ../../library/csv.rst:546 msgid "Writer objects have the following public attribute:" msgstr "寫入器物件有下列公開屬性:" -#: ../../library/csv.rst:550 +#: ../../library/csv.rst:551 msgid "A read-only description of the dialect in use by the writer." msgstr "dialect 的唯讀敘述,會被寫入器使用。" -#: ../../library/csv.rst:553 +#: ../../library/csv.rst:554 msgid "DictWriter objects have the following public method:" msgstr "DictWriter 物件有下列公開方法:" -#: ../../library/csv.rst:558 +#: ../../library/csv.rst:559 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " @@ -871,7 +872,7 @@ msgstr "" "中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" -#: ../../library/csv.rst:563 +#: ../../library/csv.rst:564 msgid "" ":meth:`writeheader` now also returns the value returned by the :meth:" "`csvwriter.writerow` method it uses internally." @@ -879,15 +880,15 @@ msgstr "" ":meth:`writeheader` 現在也會回傳內部呼叫 :meth:`csvwriter.writerow` 的回傳" "值。" -#: ../../library/csv.rst:571 +#: ../../library/csv.rst:572 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:573 +#: ../../library/csv.rst:574 msgid "The simplest example of reading a CSV file::" msgstr "最簡單的讀取 CSV 檔案範例: ::" -#: ../../library/csv.rst:575 +#: ../../library/csv.rst:576 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -901,11 +902,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:581 +#: ../../library/csv.rst:582 msgid "Reading a file with an alternate format::" msgstr "讀取一個其他格式的檔案: ::" -#: ../../library/csv.rst:583 +#: ../../library/csv.rst:584 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -919,11 +920,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:589 +#: ../../library/csv.rst:590 msgid "The corresponding simplest possible writing example is::" msgstr "相對最簡單、可行的寫入範例為: ::" -#: ../../library/csv.rst:591 +#: ../../library/csv.rst:592 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -931,7 +932,7 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -#: ../../library/csv.rst:596 +#: ../../library/csv.rst:597 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " "default be decoded into unicode using the system default encoding (see :func:" @@ -942,7 +943,7 @@ msgstr "" "碼格式(請見 :func:`locale.getencoding`),並解碼為 unicode。若要使用不同編碼" "格式進行檔案解碼,請使用 open 函式的 ``encoding`` 引數: ::" -#: ../../library/csv.rst:601 +#: ../../library/csv.rst:602 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -956,7 +957,7 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:607 +#: ../../library/csv.rst:608 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." @@ -964,11 +965,11 @@ msgstr "" "同理可以應用到使用不同編碼格式進行寫入:當開啟輸出檔案時,指定 ``encoding`` " "引數。" -#: ../../library/csv.rst:610 +#: ../../library/csv.rst:611 msgid "Registering a new dialect::" msgstr "註冊一個新的 dialect : ::" -#: ../../library/csv.rst:612 +#: ../../library/csv.rst:613 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -980,13 +981,13 @@ msgstr "" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" -#: ../../library/csv.rst:617 +#: ../../library/csv.rst:618 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "稍微進階的讀取器用法 -- 擷取及回報錯誤: ::" -#: ../../library/csv.rst:619 +#: ../../library/csv.rst:620 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -1008,13 +1009,13 @@ msgstr "" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" -#: ../../library/csv.rst:629 +#: ../../library/csv.rst:630 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "而當模組無法直接支援剖析字串時,仍可以輕鬆的解決: ::" -#: ../../library/csv.rst:632 +#: ../../library/csv.rst:633 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" @@ -1024,11 +1025,11 @@ msgstr "" "for row in csv.reader(['one,two,three']):\n" " print(row)" -#: ../../library/csv.rst:638 +#: ../../library/csv.rst:639 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:639 +#: ../../library/csv.rst:640 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` line " @@ -1037,9 +1038,9 @@ msgid "" "`universal `) newline handling." msgstr "" "如果 ``newline=''`` 沒有被指定,則嵌入引號中的換行符號不會被正確直譯,使用 " -"``\\r\\n`` 行尾 (line ending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自己 " -"(:term:`統一的 `) 換行處理方式,因此指定 ``newline=''`` " -"會永遠是安全的。" +"``\\r\\n`` 行尾 (line ending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自" +"己 (:term:`統一的 `) 換行處理方式,因此指定 " +"``newline=''`` 會永遠是安全的。" #: ../../library/csv.rst:11 msgid "csv" diff --git a/library/ctypes.po b/library/ctypes.po index e930f5d30e..6098fb15ff 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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-" @@ -47,10 +47,9 @@ 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 +75,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 @@ -209,8 +208,8 @@ 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 @@ -364,10 +363,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 @@ -376,7 +375,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2430 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2426 msgid "Fundamental data types" msgstr "" @@ -768,10 +767,10 @@ msgstr "" #: ../../library/ctypes.rst:322 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 string 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:327 @@ -809,11 +808,11 @@ msgstr "" #: ../../library/ctypes.rst:342 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:349 @@ -852,9 +851,9 @@ msgstr "" #: ../../library/ctypes.rst:377 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:381 @@ -1049,13 +1048,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 "" @@ -1072,10 +1071,9 @@ msgstr "" #: ../../library/ctypes.rst:512 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:516 @@ -1245,10 +1243,10 @@ msgstr "" #: ../../library/ctypes.rst:601 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:607 @@ -1283,11 +1281,11 @@ msgstr "" #: ../../library/ctypes.rst:625 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:630 @@ -1392,8 +1390,8 @@ msgstr "" #: ../../library/ctypes.rst:675 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " -"useful for debugging because they can provide useful information. " -"See :class:`CField`::" +"useful for debugging because they can provide useful information. See :class:" +"`CField`::" msgstr "" #: ../../library/ctypes.rst:679 @@ -1432,40 +1430,33 @@ msgstr "" #: ../../library/ctypes.rst:703 msgid "" -"It is possible to specify the maximum alignment for the fields by setting " -"the :attr:`~Structure._pack_` class attribute to a positive integer. This " -"matches what ``#pragma pack(n)`` does in MSVC." +"It is possible to specify the maximum alignment for the fields and/or for " +"the structure itself by setting the class attributes :attr:`~Structure." +"_pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute " +"documentation for details." msgstr "" -#: ../../library/ctypes.rst:707 -msgid "" -"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 definition." -msgstr "" - -#: ../../library/ctypes.rst:712 +#: ../../library/ctypes.rst:708 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:722 +#: ../../library/ctypes.rst:718 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:724 +#: ../../library/ctypes.rst:720 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:728 +#: ../../library/ctypes.rst:724 msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1485,7 +1476,7 @@ msgstr "" ">>> print(Int.second_16)\n" "" -#: ../../library/ctypes.rst:737 +#: ../../library/ctypes.rst:733 msgid "" "It is important to note that bit field allocation and layout in memory are " "not defined as a C standard; their implementation is compiler-specific. By " @@ -1494,33 +1485,33 @@ msgid "" "details on the default behavior and how to change it." msgstr "" -#: ../../library/ctypes.rst:748 +#: ../../library/ctypes.rst:744 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:750 +#: ../../library/ctypes.rst:746 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:752 +#: ../../library/ctypes.rst:748 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:755 +#: ../../library/ctypes.rst:751 msgid "TenPointsArrayType = POINT * 10" msgstr "" -#: ../../library/ctypes.rst:757 +#: ../../library/ctypes.rst:753 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:760 +#: ../../library/ctypes.rst:756 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1548,11 +1539,11 @@ msgstr "" "4\n" ">>>" -#: ../../library/ctypes.rst:773 +#: ../../library/ctypes.rst:769 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:775 +#: ../../library/ctypes.rst:771 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" @@ -1562,17 +1553,17 @@ msgstr "" "for pt in arr:\n" " print(pt.x, pt.y)" -#: ../../library/ctypes.rst:779 +#: ../../library/ctypes.rst:775 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:782 +#: ../../library/ctypes.rst:778 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:784 +#: ../../library/ctypes.rst:780 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1594,17 +1585,17 @@ msgstr "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" -#: ../../library/ctypes.rst:798 +#: ../../library/ctypes.rst:794 msgid "Pointers" msgstr "指標" -#: ../../library/ctypes.rst:800 +#: ../../library/ctypes.rst:796 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:803 +#: ../../library/ctypes.rst:799 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1616,13 +1607,13 @@ msgstr "" ">>> pi = pointer(i)\n" ">>>" -#: ../../library/ctypes.rst:808 +#: ../../library/ctypes.rst:804 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:811 +#: ../../library/ctypes.rst:807 msgid "" ">>> pi.contents\n" "c_long(42)\n" @@ -1632,13 +1623,13 @@ msgstr "" "c_long(42)\n" ">>>" -#: ../../library/ctypes.rst:815 +#: ../../library/ctypes.rst:811 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:818 +#: ../../library/ctypes.rst:814 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1652,14 +1643,14 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:824 +#: ../../library/ctypes.rst:820 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:827 +#: ../../library/ctypes.rst:823 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1673,11 +1664,11 @@ msgstr "" "c_long(99)\n" ">>>" -#: ../../library/ctypes.rst:836 +#: ../../library/ctypes.rst:832 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:838 +#: ../../library/ctypes.rst:834 msgid "" ">>> pi[0]\n" "99\n" @@ -1687,11 +1678,11 @@ msgstr "" "99\n" ">>>" -#: ../../library/ctypes.rst:842 +#: ../../library/ctypes.rst:838 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:844 +#: ../../library/ctypes.rst:840 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1707,7 +1698,7 @@ msgstr "" "c_long(22)\n" ">>>" -#: ../../library/ctypes.rst:851 +#: ../../library/ctypes.rst:847 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -1716,7 +1707,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:857 +#: ../../library/ctypes.rst:853 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -1724,7 +1715,7 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:862 +#: ../../library/ctypes.rst:858 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1748,13 +1739,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:873 +#: ../../library/ctypes.rst:869 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:876 +#: ../../library/ctypes.rst:872 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1766,13 +1757,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:881 +#: ../../library/ctypes.rst:877 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:884 +#: ../../library/ctypes.rst:880 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1798,34 +1789,37 @@ msgstr "" "ValueError: NULL pointer access\n" ">>>" -#: ../../library/ctypes.rst:899 +#: ../../library/ctypes.rst:895 msgid "Thread safety without the GIL" msgstr "" -#: ../../library/ctypes.rst:901 +#: ../../library/ctypes.rst:897 msgid "" "From Python 3.13 onward, the :term:`GIL` can be disabled on :term:`free " "threaded ` builds. In ctypes, reads and writes to a single " "object concurrently is safe, but not across multiple objects:" msgstr "" -#: ../../library/ctypes.rst:904 +#: ../../library/ctypes.rst:900 msgid "" ">>> number = c_int(42)\n" ">>> pointer_a = pointer(number)\n" ">>> pointer_b = pointer(number)" msgstr "" +">>> number = c_int(42)\n" +">>> pointer_a = pointer(number)\n" +">>> pointer_b = pointer(number)" -#: ../../library/ctypes.rst:910 +#: ../../library/ctypes.rst:906 msgid "" "In the above, it's only safe for one object to read and write to the address " "at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " "to across multiple threads, but only if ``pointer_b`` is not also attempting " -"to do the same. If this is an issue, consider using " -"a :class:`threading.Lock` to synchronize access to memory:" +"to do the same. If this is an issue, consider using a :class:`threading." +"Lock` to synchronize access to memory:" msgstr "" -#: ../../library/ctypes.rst:915 +#: ../../library/ctypes.rst:911 msgid "" ">>> import threading\n" ">>> lock = threading.Lock()\n" @@ -1836,12 +1830,20 @@ msgid "" ">>> with lock:\n" "... pointer_b.contents = 42" msgstr "" +">>> import threading\n" +">>> lock = threading.Lock()\n" +">>> # 執行緒 1\n" +">>> with lock:\n" +"... pointer_a.contents = 24\n" +">>> # 執行緒 2\n" +">>> with lock:\n" +"... pointer_b.contents = 42" -#: ../../library/ctypes.rst:930 +#: ../../library/ctypes.rst:926 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:932 +#: ../../library/ctypes.rst:928 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " @@ -1852,7 +1854,7 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:939 +#: ../../library/ctypes.rst:935 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1882,7 +1884,7 @@ msgstr "" "3\n" ">>>" -#: ../../library/ctypes.rst:953 +#: ../../library/ctypes.rst:949 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " @@ -1891,11 +1893,11 @@ msgid "" "automatically." msgstr "" -#: ../../library/ctypes.rst:958 +#: ../../library/ctypes.rst:954 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:960 +#: ../../library/ctypes.rst:956 msgid "" ">>> bar.values = None\n" ">>>" @@ -1903,7 +1905,7 @@ msgstr "" ">>> bar.values = None\n" ">>>" -#: ../../library/ctypes.rst:965 +#: ../../library/ctypes.rst:961 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -1912,7 +1914,7 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:971 +#: ../../library/ctypes.rst:967 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1928,11 +1930,11 @@ msgstr "" "instance\n" ">>>" -#: ../../library/ctypes.rst:977 +#: ../../library/ctypes.rst:973 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:979 +#: ../../library/ctypes.rst:975 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -1941,7 +1943,7 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:985 +#: ../../library/ctypes.rst:981 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1953,13 +1955,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:990 +#: ../../library/ctypes.rst:986 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:993 +#: ../../library/ctypes.rst:989 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1973,18 +1975,18 @@ msgstr "" "0\n" ">>>" -#: ../../library/ctypes.rst:1003 +#: ../../library/ctypes.rst:999 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:1005 +#: ../../library/ctypes.rst:1001 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:1009 +#: ../../library/ctypes.rst:1005 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1994,13 +1996,13 @@ msgid "" "};" msgstr "" -#: ../../library/ctypes.rst:1016 +#: ../../library/ctypes.rst:1012 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:1019 +#: ../../library/ctypes.rst:1015 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -2022,14 +2024,14 @@ msgstr "" "NameError: name 'cell' is not defined\n" ">>>" -#: ../../library/ctypes.rst:1029 +#: ../../library/ctypes.rst:1025 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:1033 +#: ../../library/ctypes.rst:1029 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -2047,13 +2049,13 @@ msgstr "" "... (\"next\", POINTER(cell))]\n" ">>>" -#: ../../library/ctypes.rst:1041 +#: ../../library/ctypes.rst:1037 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:1044 +#: ../../library/ctypes.rst:1040 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -2083,24 +2085,24 @@ msgstr "" "foo bar foo bar foo bar foo bar\n" ">>>" -#: ../../library/ctypes.rst:1062 +#: ../../library/ctypes.rst:1058 msgid "Callback functions" msgstr "回呼函式" -#: ../../library/ctypes.rst:1064 +#: ../../library/ctypes.rst:1060 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:1067 +#: ../../library/ctypes.rst:1063 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:1071 +#: ../../library/ctypes.rst:1067 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -2108,21 +2110,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:1076 +#: ../../library/ctypes.rst:1072 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:1080 +#: ../../library/ctypes.rst:1076 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:1084 +#: ../../library/ctypes.rst:1080 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -2136,7 +2138,7 @@ msgstr "" ">>> qsort.restype = None\n" ">>>" -#: ../../library/ctypes.rst:1090 +#: ../../library/ctypes.rst:1086 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -2146,13 +2148,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:1096 +#: ../../library/ctypes.rst:1092 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:1099 +#: ../../library/ctypes.rst:1095 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" @@ -2160,13 +2162,13 @@ msgstr "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" -#: ../../library/ctypes.rst:1102 +#: ../../library/ctypes.rst:1098 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:1105 +#: ../../library/ctypes.rst:1101 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2182,11 +2184,11 @@ msgstr "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" -#: ../../library/ctypes.rst:1112 +#: ../../library/ctypes.rst:1108 msgid "The result::" msgstr "結果為: ::" -#: ../../library/ctypes.rst:1114 +#: ../../library/ctypes.rst:1110 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" @@ -2204,11 +2206,11 @@ msgstr "" "py_cmp_func 1 7\n" ">>>" -#: ../../library/ctypes.rst:1122 +#: ../../library/ctypes.rst:1118 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1124 +#: ../../library/ctypes.rst:1120 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2236,11 +2238,11 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1137 +#: ../../library/ctypes.rst:1133 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1139 +#: ../../library/ctypes.rst:1135 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -2252,13 +2254,13 @@ msgstr "" "1 5 7 33 99\n" ">>>" -#: ../../library/ctypes.rst:1144 +#: ../../library/ctypes.rst:1140 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1147 +#: ../../library/ctypes.rst:1143 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -2286,14 +2288,14 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1162 +#: ../../library/ctypes.rst:1158 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1166 +#: ../../library/ctypes.rst:1162 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -2303,25 +2305,25 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1176 +#: ../../library/ctypes.rst:1172 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1178 +#: ../../library/ctypes.rst:1174 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: ../../library/ctypes.rst:1182 +#: ../../library/ctypes.rst:1178 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1186 +#: ../../library/ctypes.rst:1182 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" @@ -2331,17 +2333,17 @@ msgstr "" ">>> print(hex(version.value))\n" "0x30c00a0" -#: ../../library/ctypes.rst:1190 +#: ../../library/ctypes.rst:1186 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1193 +#: ../../library/ctypes.rst:1189 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1195 +#: ../../library/ctypes.rst:1191 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -2350,13 +2352,13 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1200 +#: ../../library/ctypes.rst:1196 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1203 +#: ../../library/ctypes.rst:1199 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -2380,13 +2382,13 @@ msgstr "" "...\n" ">>>" -#: ../../library/ctypes.rst:1214 +#: ../../library/ctypes.rst:1210 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1217 +#: ../../library/ctypes.rst:1213 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" @@ -2396,7 +2398,7 @@ msgstr "" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" -#: ../../library/ctypes.rst:1221 +#: ../../library/ctypes.rst:1217 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -2405,7 +2407,7 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1227 +#: ../../library/ctypes.rst:1223 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -2427,28 +2429,28 @@ msgstr "" "zipimport 12345\n" ">>>" -#: ../../library/ctypes.rst:1237 +#: ../../library/ctypes.rst:1233 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1245 +#: ../../library/ctypes.rst:1241 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1247 +#: ../../library/ctypes.rst:1243 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1250 +#: ../../library/ctypes.rst:1246 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1252 +#: ../../library/ctypes.rst:1248 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2486,13 +2488,13 @@ msgstr "" "3 4 3 4\n" ">>>" -#: ../../library/ctypes.rst:1270 +#: ../../library/ctypes.rst:1266 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1273 +#: ../../library/ctypes.rst:1269 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -2504,7 +2506,7 @@ msgstr "" ">>> rc.b = temp1\n" ">>>" -#: ../../library/ctypes.rst:1278 +#: ../../library/ctypes.rst:1274 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2513,20 +2515,20 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1284 +#: ../../library/ctypes.rst:1280 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1288 +#: ../../library/ctypes.rst:1284 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1290 +#: ../../library/ctypes.rst:1286 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2544,13 +2546,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:1300 +#: ../../library/ctypes.rst:1296 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1303 +#: ../../library/ctypes.rst:1299 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -2559,16 +2561,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1313 +#: ../../library/ctypes.rst:1309 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1315 +#: ../../library/ctypes.rst:1311 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1317 +#: ../../library/ctypes.rst:1313 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -2577,7 +2579,7 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1323 +#: ../../library/ctypes.rst:1319 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2607,14 +2609,14 @@ msgstr "" "8\n" ">>>" -#: ../../library/ctypes.rst:1337 +#: ../../library/ctypes.rst:1333 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1341 +#: ../../library/ctypes.rst:1337 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2632,28 +2634,28 @@ msgstr "" "IndexError: invalid index\n" ">>>" -#: ../../library/ctypes.rst:1349 +#: ../../library/ctypes.rst:1345 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1357 +#: ../../library/ctypes.rst:1353 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1363 +#: ../../library/ctypes.rst:1359 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1365 +#: ../../library/ctypes.rst:1361 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1368 +#: ../../library/ctypes.rst:1364 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -2662,13 +2664,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1374 +#: ../../library/ctypes.rst:1370 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1382 +#: ../../library/ctypes.rst:1378 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -2676,29 +2678,29 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1387 ../../library/ctypes.rst:2135 +#: ../../library/ctypes.rst:1383 ../../library/ctypes.rst:2131 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1389 +#: ../../library/ctypes.rst:1385 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1393 +#: ../../library/ctypes.rst:1389 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1397 +#: ../../library/ctypes.rst:1393 msgid "Here are some examples::" msgstr "以下是一些範例: ::" -#: ../../library/ctypes.rst:1399 +#: ../../library/ctypes.rst:1395 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2718,14 +2720,14 @@ msgstr "" "'libbz2.so.1.0'\n" ">>>" -#: ../../library/ctypes.rst:1408 +#: ../../library/ctypes.rst:1404 msgid "" "On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " "standard naming schemes and paths to locate the library, and returns a full " "pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1412 +#: ../../library/ctypes.rst:1408 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2749,7 +2751,7 @@ msgstr "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" -#: ../../library/ctypes.rst:1423 +#: ../../library/ctypes.rst:1419 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -2757,7 +2759,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ctypes.rst:1427 +#: ../../library/ctypes.rst:1423 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -2765,18 +2767,18 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1435 +#: ../../library/ctypes.rst:1431 msgid "Listing loaded shared libraries" msgstr "" -#: ../../library/ctypes.rst:1437 +#: ../../library/ctypes.rst:1433 msgid "" "When writing code that relies on code loaded from shared libraries, it can " "be useful to know which shared libraries have already been loaded into the " "current process." msgstr "" -#: ../../library/ctypes.rst:1441 +#: ../../library/ctypes.rst:1437 msgid "" "The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " "function, which calls the different APIs provided by the various platforms " @@ -2784,7 +2786,7 @@ msgid "" "current process." msgstr "" -#: ../../library/ctypes.rst:1445 +#: ../../library/ctypes.rst:1441 msgid "" "The exact output of this function will be system dependent. On most " "platforms, the first entry of this list represents the current process " @@ -2792,56 +2794,59 @@ msgid "" "return may look like::" msgstr "" -#: ../../library/ctypes.rst:1450 +#: ../../library/ctypes.rst:1446 msgid "" ">>> from ctypes.util import dllist\n" ">>> dllist()\n" "['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" "linux-gnu/libc.so.6', ... ]" msgstr "" +">>> from ctypes.util import dllist\n" +">>> dllist()\n" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" -#: ../../library/ctypes.rst:1457 +#: ../../library/ctypes.rst:1453 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1459 +#: ../../library/ctypes.rst:1455 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1465 +#: ../../library/ctypes.rst:1461 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1469 +#: ../../library/ctypes.rst:1465 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." -msgstr "" - -#: ../../library/ctypes.rst:1481 ../../library/ctypes.rst:1506 -#: ../../library/ctypes.rst:1519 ../../library/ctypes.rst:1537 +"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:1477 ../../library/ctypes.rst:1502 +#: ../../library/ctypes.rst:1515 ../../library/ctypes.rst:1533 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: ../../library/ctypes.rst:1485 +#: ../../library/ctypes.rst:1481 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1491 +#: ../../library/ctypes.rst:1487 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " @@ -2851,38 +2856,38 @@ msgid "" "a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1498 ../../library/ctypes.rst:1515 -#: ../../library/ctypes.rst:1659 ../../library/ctypes.rst:1667 -#: ../../library/ctypes.rst:1839 ../../library/ctypes.rst:1891 -#: ../../library/ctypes.rst:2043 ../../library/ctypes.rst:2115 -#: ../../library/ctypes.rst:2124 ../../library/ctypes.rst:2149 -#: ../../library/ctypes.rst:2163 ../../library/ctypes.rst:2172 -#: ../../library/ctypes.rst:2181 ../../library/ctypes.rst:2196 -#: ../../library/ctypes.rst:2263 ../../library/ctypes.rst:2290 -#: ../../library/ctypes.rst:2690 ../../library/ctypes.rst:3088 +#: ../../library/ctypes.rst:1494 ../../library/ctypes.rst:1511 +#: ../../library/ctypes.rst:1655 ../../library/ctypes.rst:1663 +#: ../../library/ctypes.rst:1835 ../../library/ctypes.rst:1887 +#: ../../library/ctypes.rst:2039 ../../library/ctypes.rst:2111 +#: ../../library/ctypes.rst:2120 ../../library/ctypes.rst:2145 +#: ../../library/ctypes.rst:2159 ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2192 +#: ../../library/ctypes.rst:2259 ../../library/ctypes.rst:2286 +#: ../../library/ctypes.rst:2686 ../../library/ctypes.rst:3104 msgid "Availability" msgstr "可用性" -#: ../../library/ctypes.rst:1500 +#: ../../library/ctypes.rst:1496 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:1511 +#: ../../library/ctypes.rst:1507 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " "return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1522 +#: ../../library/ctypes.rst:1518 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1528 +#: ../../library/ctypes.rst:1524 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2890,11 +2895,11 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1533 +#: ../../library/ctypes.rst:1529 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1539 +#: ../../library/ctypes.rst:1535 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " @@ -2904,7 +2909,7 @@ msgid "" "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1546 +#: ../../library/ctypes.rst:1542 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2912,35 +2917,33 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1551 +#: ../../library/ctypes.rst:1547 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:1558 +#: ../../library/ctypes.rst:1554 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1562 +#: ../../library/ctypes.rst:1558 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:1568 +#: ../../library/ctypes.rst:1564 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2950,29 +2953,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1575 +#: ../../library/ctypes.rst:1571 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1582 +#: ../../library/ctypes.rst:1578 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1589 +#: ../../library/ctypes.rst:1585 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1596 +#: ../../library/ctypes.rst:1592 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1599 +#: ../../library/ctypes.rst:1595 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2981,7 +2984,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1605 +#: ../../library/ctypes.rst:1601 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2997,21 +3000,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1612 +#: ../../library/ctypes.rst:1608 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1618 +#: ../../library/ctypes.rst:1614 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1623 +#: ../../library/ctypes.rst:1619 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1625 +#: ../../library/ctypes.rst:1621 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -3019,13 +3022,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1633 +#: ../../library/ctypes.rst:1629 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:1636 +#: ../../library/ctypes.rst:1632 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -3033,72 +3036,72 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1642 +#: ../../library/ctypes.rst:1638 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1646 +#: ../../library/ctypes.rst:1642 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1651 +#: ../../library/ctypes.rst:1647 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1657 +#: ../../library/ctypes.rst:1653 msgid "Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1665 +#: ../../library/ctypes.rst:1661 msgid "Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1673 +#: ../../library/ctypes.rst:1669 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1676 +#: ../../library/ctypes.rst:1672 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1682 +#: ../../library/ctypes.rst:1678 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:1687 ../../library/ctypes.rst:1689 +#: ../../library/ctypes.rst:1683 ../../library/ctypes.rst:1685 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1693 ../../library/ctypes.rst:1695 +#: ../../library/ctypes.rst:1689 ../../library/ctypes.rst:1691 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:1699 ../../library/ctypes.rst:1701 +#: ../../library/ctypes.rst:1695 ../../library/ctypes.rst:1697 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1708 +#: ../../library/ctypes.rst:1704 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1710 +#: ../../library/ctypes.rst:1706 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -3107,13 +3110,13 @@ msgid "" "library loader." msgstr "" -#: ../../library/ctypes.rst:1715 +#: ../../library/ctypes.rst:1711 msgid "" "They are instances of a private local class :class:`!_FuncPtr` (not exposed " "in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" -#: ../../library/ctypes.rst:1718 +#: ../../library/ctypes.rst:1714 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -3122,30 +3125,36 @@ msgid "" ">>> lib._FuncPtr is ctypes._CFuncPtr\n" "False" msgstr "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" -#: ../../library/ctypes.rst:1729 +#: ../../library/ctypes.rst:1725 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1731 +#: ../../library/ctypes.rst:1727 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1734 +#: ../../library/ctypes.rst:1730 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1739 +#: ../../library/ctypes.rst:1735 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1742 +#: ../../library/ctypes.rst:1738 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -3155,7 +3164,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1751 +#: ../../library/ctypes.rst:1747 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -3164,17 +3173,17 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1757 +#: ../../library/ctypes.rst:1753 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:1764 +#: ../../library/ctypes.rst:1760 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -3182,58 +3191,58 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1771 +#: ../../library/ctypes.rst:1767 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1774 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1777 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1785 +#: ../../library/ctypes.rst:1781 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1789 +#: ../../library/ctypes.rst:1785 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1794 ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1790 ../../library/ctypes.rst:1792 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:1802 ../../library/ctypes.rst:1804 +#: ../../library/ctypes.rst:1798 ../../library/ctypes.rst:1800 msgid "" "Some ways to invoke foreign function calls as well as some of the functions " "in this module may raise an auditing event ``ctypes.call_function`` with " "arguments ``function pointer`` and ``arguments``." msgstr "" -#: ../../library/ctypes.rst:1811 +#: ../../library/ctypes.rst:1807 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1813 +#: ../../library/ctypes.rst:1809 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3244,47 +3253,46 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1824 +#: ../../library/ctypes.rst:1820 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:1834 +#: ../../library/ctypes.rst:1830 msgid "" "The returned function prototype creates functions that use the ``stdcall`` " "calling convention. The function will release the GIL during the call. " "*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1844 +#: ../../library/ctypes.rst:1840 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1843 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1854 +#: ../../library/ctypes.rst:1850 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1861 +#: ../../library/ctypes.rst:1857 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1868 +#: ../../library/ctypes.rst:1864 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3292,7 +3300,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1878 +#: ../../library/ctypes.rst:1874 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3300,86 +3308,86 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1883 +#: ../../library/ctypes.rst:1879 msgid "" "If *iid* is not specified, an :exc:`OSError` is raised if the COM method " "call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " "instead." msgstr "" -#: ../../library/ctypes.rst:1887 +#: ../../library/ctypes.rst:1883 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1894 +#: ../../library/ctypes.rst:1890 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1897 +#: ../../library/ctypes.rst:1893 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:1899 +#: ../../library/ctypes.rst:1895 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1902 +#: ../../library/ctypes.rst:1898 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1905 +#: ../../library/ctypes.rst:1901 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1906 +#: ../../library/ctypes.rst:1902 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1904 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1909 +#: ../../library/ctypes.rst:1905 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1911 +#: ../../library/ctypes.rst:1907 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1912 +#: ../../library/ctypes.rst:1908 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1914 +#: ../../library/ctypes.rst:1910 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1917 +#: ../../library/ctypes.rst:1913 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1920 +#: ../../library/ctypes.rst:1916 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1924 +#: ../../library/ctypes.rst:1920 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3395,11 +3403,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1931 ../../library/ctypes.rst:1954 +#: ../../library/ctypes.rst:1927 ../../library/ctypes.rst:1950 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1933 +#: ../../library/ctypes.rst:1929 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3415,11 +3423,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1939 +#: ../../library/ctypes.rst:1935 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1941 +#: ../../library/ctypes.rst:1937 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3429,7 +3437,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1945 +#: ../../library/ctypes.rst:1941 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3437,7 +3445,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1949 +#: ../../library/ctypes.rst:1945 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3449,7 +3457,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1956 +#: ../../library/ctypes.rst:1952 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3467,7 +3475,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1963 +#: ../../library/ctypes.rst:1959 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3475,7 +3483,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1968 +#: ../../library/ctypes.rst:1964 msgid "" "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3484,7 +3492,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1973 +#: ../../library/ctypes.rst:1969 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3502,7 +3510,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1981 +#: ../../library/ctypes.rst:1977 msgid "" "If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3511,7 +3519,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1983 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3531,64 +3539,64 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:2000 +#: ../../library/ctypes.rst:1996 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:2004 +#: ../../library/ctypes.rst:2000 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2007 +#: ../../library/ctypes.rst:2003 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " -"``ctypes.addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." +"addressof``。" -#: ../../library/ctypes.rst:2012 +#: ../../library/ctypes.rst:2008 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:2018 +#: ../../library/ctypes.rst:2014 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:2022 +#: ../../library/ctypes.rst:2018 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:2024 +#: ../../library/ctypes.rst:2020 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:2026 +#: ../../library/ctypes.rst:2022 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:2032 +#: ../../library/ctypes.rst:2028 msgid "" -"Copies a COM pointer from *src* to *dst* and returns the Windows " -"specific :c:type:`!HRESULT` value." +"Copies a COM pointer from *src* to *dst* and returns the Windows specific :c:" +"type:`!HRESULT` value." msgstr "" -#: ../../library/ctypes.rst:2035 +#: ../../library/ctypes.rst:2031 msgid "" "If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " "reference count." msgstr "" -#: ../../library/ctypes.rst:2038 +#: ../../library/ctypes.rst:2034 msgid "" "In contrast, the reference count of *dst* will not be decremented before " "assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " @@ -3596,7 +3604,7 @@ msgid "" "necessary." msgstr "" -#: ../../library/ctypes.rst:2050 +#: ../../library/ctypes.rst:2046 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3604,47 +3612,47 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:2059 +#: ../../library/ctypes.rst:2055 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2058 msgid "" "If *size* is given (and not ``None``), it must be an :class:`int`. It " "specifies the size of the returned array." msgstr "" -#: ../../library/ctypes.rst:2065 +#: ../../library/ctypes.rst:2061 msgid "" "If the *init* argument is given, it must be :class:`bytes`. It is used to " "initialize the array items. Bytes not initialized this way are set to zero " "(NUL)." msgstr "" -#: ../../library/ctypes.rst:2069 +#: ../../library/ctypes.rst:2065 msgid "" "If *size* is not given (or if it is ``None``), the buffer is made one " "element larger than *init*, effectively adding a NUL terminator." msgstr "" -#: ../../library/ctypes.rst:2072 +#: ../../library/ctypes.rst:2068 msgid "" "If both arguments are given, *size* must not be less than ``len(init)``." -msgstr "" +msgstr "如果兩個引數皆有提供,*size* 不得小於 ``len(init)``。" -#: ../../library/ctypes.rst:2076 +#: ../../library/ctypes.rst:2072 msgid "" "If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not " "treat such a buffer as a C string." msgstr "" -#: ../../library/ctypes.rst:2079 +#: ../../library/ctypes.rst:2075 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" -#: ../../library/ctypes.rst:2081 +#: ../../library/ctypes.rst:2077 msgid "" ">>> bytes(create_string_buffer(2))\n" "b'\\x00\\x00'\n" @@ -3659,8 +3667,20 @@ msgid "" " ...\n" "ValueError: byte string too long" msgstr "" +">>> bytes(create_string_buffer(2))\n" +"b'\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'ab'))\n" +"b'ab\\x00'\n" +">>> bytes(create_string_buffer(b'ab', 2))\n" +"b'ab'\n" +">>> bytes(create_string_buffer(b'ab', 4))\n" +"b'ab\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'abcdef', 2))\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: byte string too long" -#: ../../library/ctypes.rst:2094 +#: ../../library/ctypes.rst:2090 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3668,19 +3688,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:2100 +#: ../../library/ctypes.rst:2096 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2103 +#: ../../library/ctypes.rst:2099 msgid "" "The function takes the same arguments as :func:`~create_string_buffer` " "except *init* must be a string and *size* counts :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2106 +#: ../../library/ctypes.rst:2102 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3688,21 +3708,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:2111 +#: ../../library/ctypes.rst:2107 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllCanUnloadNow function that the " "_ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2120 +#: ../../library/ctypes.rst:2116 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllGetClassObject function that the " "``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2130 +#: ../../library/ctypes.rst:2126 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3710,21 +3730,21 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:2141 +#: ../../library/ctypes.rst:2137 msgid "" "Returns the filename of the VC runtime library used by Python, and by the " "extension modules. If the name of the library cannot be determined, " "``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:2145 +#: ../../library/ctypes.rst:2141 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:2155 +#: ../../library/ctypes.rst:2151 msgid "" "Try to provide a list of paths of the shared libraries loaded into the " "current process. These paths are not normalized or processed in any way. " @@ -3732,74 +3752,74 @@ msgid "" "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:2160 +#: ../../library/ctypes.rst:2156 msgid "" "On most platforms, the first element of the list represents the current " "executable file. It may be an empty string." msgstr "" -#: ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2164 msgid "" "Returns a textual description of the error code *code*. If no error code is " -"specified, the last error code is used by calling the Windows API " -"function :func:`GetLastError`." +"specified, the last error code is used by calling the Windows API function :" +"func:`GetLastError`." msgstr "" -#: ../../library/ctypes.rst:2177 +#: ../../library/ctypes.rst:2173 msgid "" "Returns the last error code set by Windows in the calling thread. This " "function calls the Windows ``GetLastError()`` function directly, it does not " "return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2186 +#: ../../library/ctypes.rst:2182 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:2189 +#: ../../library/ctypes.rst:2185 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2193 +#: ../../library/ctypes.rst:2189 msgid "" "Returns the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2198 +#: ../../library/ctypes.rst:2194 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2203 +#: ../../library/ctypes.rst:2199 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2210 +#: ../../library/ctypes.rst:2206 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2213 msgid "" "Create or return a ctypes pointer type. Pointer types are cached and reused " "internally, so calling this function repeatedly is cheap. *type* must be a " "ctypes type." msgstr "" -#: ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2219 msgid "" "The resulting pointer type is cached in the ``__pointer_type__`` attribute " "of *type*. It is possible to set this attribute before the first call to " @@ -3808,19 +3828,19 @@ msgid "" "relying on implementation details that may change in future Python versions." msgstr "" -#: ../../library/ctypes.rst:2234 +#: ../../library/ctypes.rst:2230 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2237 +#: ../../library/ctypes.rst:2233 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2243 +#: ../../library/ctypes.rst:2239 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3828,145 +3848,145 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2251 +#: ../../library/ctypes.rst:2247 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2254 +#: ../../library/ctypes.rst:2250 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:2259 +#: ../../library/ctypes.rst:2255 msgid "" "Sets the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread to *value* and return the previous " "value." msgstr "" -#: ../../library/ctypes.rst:2265 +#: ../../library/ctypes.rst:2261 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:2270 +#: ../../library/ctypes.rst:2266 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2276 +#: ../../library/ctypes.rst:2272 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2280 +#: ../../library/ctypes.rst:2276 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:2285 +#: ../../library/ctypes.rst:2281 msgid "" -"Creates an instance of :exc:`OSError`. If *code* is not " -"specified, :func:`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." +"Creates an instance of :exc:`OSError`. If *code* is not specified, :func:" +"`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." msgstr "" -#: ../../library/ctypes.rst:2292 +#: ../../library/ctypes.rst:2288 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2299 +#: ../../library/ctypes.rst:2295 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2304 +#: ../../library/ctypes.rst:2300 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:2309 +#: ../../library/ctypes.rst:2305 msgid "" "Return a :class:`memoryview` object of length *size* that references memory " "starting at *void \\*ptr*." msgstr "" -#: ../../library/ctypes.rst:2312 +#: ../../library/ctypes.rst:2308 msgid "" "If *readonly* is true, the returned :class:`!memoryview` object can not be " "used to modify the underlying memory. (Changes made by other means will " "still be reflected in the returned object.)" msgstr "" -#: ../../library/ctypes.rst:2317 +#: ../../library/ctypes.rst:2313 msgid "" "This function is similar to :func:`string_at` with the key difference of not " "making a copy of the specified memory. It is a semantically equivalent (but " -"more efficient) alternative to ``memoryview((c_byte * " -"size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " -"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or " -"a :func:`~ctypes.byref` object.)" +"more efficient) alternative to ``memoryview((c_byte * size)." +"from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:" +"`~ctypes.byref` object.)" msgstr "" -#: ../../library/ctypes.rst:2324 +#: ../../library/ctypes.rst:2320 msgid "" "Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " "arguments ``address``, ``size``, ``readonly``." msgstr "" -"引發一個附帶引數 ``address``、``size`` 與 ``readonly`` 的\\ :ref:`稽核事件 ` " -"``ctypes.memoryview_at``。" +"引發一個附帶引數 ``address``、``size`` 與 ``readonly`` 的\\ :ref:`稽核事件 " +"` ``ctypes.memoryview_at``。" -#: ../../library/ctypes.rst:2332 +#: ../../library/ctypes.rst:2328 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2337 +#: ../../library/ctypes.rst:2333 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 "" -#: ../../library/ctypes.rst:2344 +#: ../../library/ctypes.rst:2340 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2349 +#: ../../library/ctypes.rst:2345 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:2355 ../../library/ctypes.rst:2365 +#: ../../library/ctypes.rst:2351 ../../library/ctypes.rst:2361 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3974,7 +3994,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2359 +#: ../../library/ctypes.rst:2355 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3982,20 +4002,19 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2369 +#: ../../library/ctypes.rst:2365 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2372 ../../library/ctypes.rst:2374 +#: ../../library/ctypes.rst:2368 ../../library/ctypes.rst:2370 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:2380 +#: ../../library/ctypes.rst:2376 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -4003,50 +4022,50 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2385 +#: ../../library/ctypes.rst:2381 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2391 +#: ../../library/ctypes.rst:2387 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2395 +#: ../../library/ctypes.rst:2391 msgid "Common class variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2399 +#: ../../library/ctypes.rst:2395 msgid "" "The pointer type that was created by calling :func:`POINTER` for " "corresponding ctypes data type. If a pointer type was not yet created, the " "attribute is missing." msgstr "" -#: ../../library/ctypes.rst:2405 +#: ../../library/ctypes.rst:2401 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2409 +#: ../../library/ctypes.rst:2405 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:2416 +#: ../../library/ctypes.rst:2412 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2421 +#: ../../library/ctypes.rst:2417 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -4054,20 +4073,20 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2434 +#: ../../library/ctypes.rst:2430 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 "" -#: ../../library/ctypes.rst:2440 +#: ../../library/ctypes.rst:2436 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2444 +#: ../../library/ctypes.rst:2440 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -4075,7 +4094,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2449 +#: ../../library/ctypes.rst:2445 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -4083,7 +4102,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2455 +#: ../../library/ctypes.rst:2451 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -4093,7 +4112,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2459 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -4101,25 +4120,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2468 +#: ../../library/ctypes.rst:2464 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2472 +#: ../../library/ctypes.rst:2468 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2479 +#: ../../library/ctypes.rst:2475 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2486 +#: ../../library/ctypes.rst:2482 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -4127,287 +4146,287 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2494 +#: ../../library/ctypes.rst:2490 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2500 +#: ../../library/ctypes.rst:2496 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2506 +#: ../../library/ctypes.rst:2502 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2512 +#: ../../library/ctypes.rst:2508 msgid "" "Represents the C :c:expr:`double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2520 +#: ../../library/ctypes.rst:2516 msgid "" "Represents the C :c:expr:`float complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2528 +#: ../../library/ctypes.rst:2524 msgid "" "Represents the C :c:expr:`long double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2536 +#: ../../library/ctypes.rst:2532 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2543 +#: ../../library/ctypes.rst:2539 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias " -"for :class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for :" +"class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2549 +#: ../../library/ctypes.rst:2545 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2555 +#: ../../library/ctypes.rst:2551 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2561 +#: ../../library/ctypes.rst:2557 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2567 +#: ../../library/ctypes.rst:2563 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2573 +#: ../../library/ctypes.rst:2569 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2579 +#: ../../library/ctypes.rst:2575 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2585 +#: ../../library/ctypes.rst:2581 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2590 +#: ../../library/ctypes.rst:2586 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2597 +#: ../../library/ctypes.rst:2593 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2604 +#: ../../library/ctypes.rst:2600 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2611 +#: ../../library/ctypes.rst:2607 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2618 +#: ../../library/ctypes.rst:2614 msgid "" -"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias " -"for :class:`c_ubyte`." +"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for :" +"class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2624 +#: ../../library/ctypes.rst:2620 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2630 +#: ../../library/ctypes.rst:2626 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2636 +#: ../../library/ctypes.rst:2632 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2642 +#: ../../library/ctypes.rst:2638 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2648 +#: ../../library/ctypes.rst:2644 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2654 +#: ../../library/ctypes.rst:2650 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2660 +#: ../../library/ctypes.rst:2656 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2666 +#: ../../library/ctypes.rst:2662 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2673 +#: ../../library/ctypes.rst:2669 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2680 +#: ../../library/ctypes.rst:2676 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2687 +#: ../../library/ctypes.rst:2683 msgid "" "Represents a :c:type:`!HRESULT` value, which contains success or error " "information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2695 +#: ../../library/ctypes.rst:2691 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2698 +#: ../../library/ctypes.rst:2694 msgid ":class:`!py_object` is now a :term:`generic type`." msgstr "" -#: ../../library/ctypes.rst:2701 +#: ../../library/ctypes.rst:2697 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:2709 +#: ../../library/ctypes.rst:2705 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2714 +#: ../../library/ctypes.rst:2710 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2716 +#: ../../library/ctypes.rst:2712 msgid "" -"Unions share common attributes and behavior with structures; " -"see :class:`Structure` documentation for details." +"Unions share common attributes and behavior with structures; see :class:" +"`Structure` documentation for details." msgstr "" -#: ../../library/ctypes.rst:2721 +#: ../../library/ctypes.rst:2717 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2727 +#: ../../library/ctypes.rst:2723 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2733 +#: ../../library/ctypes.rst:2729 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2738 +#: ../../library/ctypes.rst:2734 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2740 +#: ../../library/ctypes.rst:2736 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2746 +#: ../../library/ctypes.rst:2742 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2748 +#: ../../library/ctypes.rst:2744 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:2756 +#: ../../library/ctypes.rst:2752 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2760 +#: ../../library/ctypes.rst:2756 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2764 +#: ../../library/ctypes.rst:2760 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2767 +#: ../../library/ctypes.rst:2763 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2771 +#: ../../library/ctypes.rst:2767 msgid "" "class List(Structure):\n" " pass\n" @@ -4421,41 +4440,55 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2777 +#: ../../library/ctypes.rst:2773 msgid "" "The :attr:`!_fields_` class variable can only be set once. Later assignments " "will raise an :exc:`AttributeError`." msgstr "" -#: ../../library/ctypes.rst:2780 +#: ../../library/ctypes.rst:2776 msgid "" "Additionally, the :attr:`!_fields_` class variable must be defined before " "the structure or union type is first used: an instance or subclass is " -"created, :func:`sizeof` is called on it, and so on. Later assignments " -"to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!" -"_fields_` has not been set before such use, the structure or union will have " -"no own fields, as if :attr:`!_fields_` was empty." +"created, :func:`sizeof` is called on it, and so on. Later assignments to :" +"attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!_fields_` " +"has not been set before such use, the structure or union will have no own " +"fields, as if :attr:`!_fields_` was empty." msgstr "" -#: ../../library/ctypes.rst:2788 +#: ../../library/ctypes.rst:2784 msgid "" "Sub-subclasses of structure types inherit the fields of the base class plus " "the :attr:`_fields_` defined in the sub-subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2794 +#: ../../library/ctypes.rst:2790 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." msgstr "" -#: ../../library/ctypes.rst:2799 -msgid "This is only implemented for the MSVC-compatible memory layout." +#: ../../library/ctypes.rst:2793 +msgid "" +"This is only implemented for the MSVC-compatible memory layout (see :attr:" +"`_layout_`)." msgstr "" -#: ../../library/ctypes.rst:2803 +#: ../../library/ctypes.rst:2796 +msgid "" +"Setting :attr:`!_pack_` to 0 is the same as not setting it at all. " +"Otherwise, the value must be a positive power of two. The effect is " +"equivalent to ``#pragma pack(N)`` in C, except :mod:`ctypes` may allow " +"larger *n* than what the compiler accepts." +msgstr "" + +#: ../../library/ctypes.rst:2801 +msgid "" +":attr:`!_pack_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: ../../library/ctypes.rst:2806 msgid "" "For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " "layout will be used by default. On non-Windows platforms, this default is " @@ -4463,33 +4496,57 @@ msgid "" "intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." msgstr "" -#: ../../library/ctypes.rst:2812 +#: ../../library/ctypes.rst:2815 msgid "" -"An optional small integer that allows overriding the alignment of the " -"structure when being packed or unpacked to/from memory. Setting this " -"attribute to 0 is the same as not setting it at all." +"An optional small integer that allows increasing the alignment of the " +"structure when being packed or unpacked to/from memory." msgstr "" -#: ../../library/ctypes.rst:2820 +#: ../../library/ctypes.rst:2818 +msgid "" +"The value must not be negative. The effect is equivalent to " +"``__attribute__((aligned(N)))`` on GCC or ``#pragma align(N)`` on MSVC, " +"except :mod:`ctypes` may allow values that the compiler would reject." +msgstr "" + +#: ../../library/ctypes.rst:2823 +msgid "" +":attr:`!_align_` can only *increase* a structure's alignment requirements. " +"Setting it to 0 or 1 has no effect." +msgstr "" + +#: ../../library/ctypes.rst:2826 +msgid "" +"Using values that are not powers of two is discouraged and may lead to " +"surprising behavior." +msgstr "" + +#: ../../library/ctypes.rst:2829 +msgid "" +":attr:`!_align_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: ../../library/ctypes.rst:2836 msgid "" "An optional string naming the struct/union layout. It can currently be set " "to:" msgstr "" -#: ../../library/ctypes.rst:2823 +#: ../../library/ctypes.rst:2839 msgid "" "``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " "Clang, this layout can be selected with ``__attribute__((ms_struct))``." msgstr "" -#: ../../library/ctypes.rst:2826 +#: ../../library/ctypes.rst:2842 msgid "" "``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " -"data model, as used on Linux and macOS. With this " -"layout, :attr:`~Structure._pack_` must be unset or zero." +"data model, as used on Linux and macOS. With this layout, :attr:`~Structure." +"_pack_` must be unset or zero." msgstr "" -#: ../../library/ctypes.rst:2830 +#: ../../library/ctypes.rst:2846 msgid "" "If not set explicitly, ``ctypes`` will use a default that matches the " "platform conventions. This default may change in future Python releases (for " @@ -4497,46 +4554,46 @@ msgid "" "between similar platforms is found). Currently the default will be:" msgstr "" -#: ../../library/ctypes.rst:2836 +#: ../../library/ctypes.rst:2852 msgid "On Windows: ``\"ms\"``" msgstr "" -#: ../../library/ctypes.rst:2837 +#: ../../library/ctypes.rst:2853 msgid "" "When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " "deprecated; see :attr:`~Structure._pack_` documentation.)" msgstr "" -#: ../../library/ctypes.rst:2839 +#: ../../library/ctypes.rst:2855 msgid "Otherwise: ``\"gcc-sysv\"``" msgstr "" -#: ../../library/ctypes.rst:2841 +#: ../../library/ctypes.rst:2857 msgid "" ":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " "is assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2848 +#: ../../library/ctypes.rst:2864 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:2852 +#: ../../library/ctypes.rst:2868 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 "" -#: ../../library/ctypes.rst:2857 +#: ../../library/ctypes.rst:2873 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2859 +#: ../../library/ctypes.rst:2875 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4558,7 +4615,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2870 +#: ../../library/ctypes.rst:2886 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4568,7 +4625,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2877 +#: ../../library/ctypes.rst:2893 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4580,15 +4637,15 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2882 +#: ../../library/ctypes.rst:2898 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:2887 +#: ../../library/ctypes.rst:2903 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4598,13 +4655,13 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2897 +#: ../../library/ctypes.rst:2913 msgid "" "Descriptor for fields of a :class:`Structure` and :class:`Union`. For " "example::" msgstr "" -#: ../../library/ctypes.rst:2900 +#: ../../library/ctypes.rst:2916 msgid "" ">>> class Color(Structure):\n" "... _fields_ = (\n" @@ -4626,196 +4683,214 @@ msgid "" ">>> Color.blinking.bit_offset\n" "1" msgstr "" +">>> class Color(Structure):\n" +"... _fields_ = (\n" +"... ('red', c_uint8),\n" +"... ('green', c_uint8),\n" +"... ('blue', c_uint8),\n" +"... ('intense', c_bool, 1),\n" +"... ('blinking', c_bool, 1),\n" +"... )\n" +"...\n" +">>> Color.red\n" +"\n" +">>> Color.green.type\n" +"\n" +">>> Color.blue.byte_offset\n" +"2\n" +">>> Color.intense\n" +"\n" +">>> Color.blinking.bit_offset\n" +"1" -#: ../../library/ctypes.rst:2920 +#: ../../library/ctypes.rst:2936 msgid "All attributes are read-only." msgstr "" -#: ../../library/ctypes.rst:2922 +#: ../../library/ctypes.rst:2938 msgid "" ":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " "instantiate the class directly." msgstr "" -#: ../../library/ctypes.rst:2927 +#: ../../library/ctypes.rst:2943 msgid "" "Previously, descriptors only had ``offset`` and ``size`` attributes and a " "readable string representation; the :class:`!CField` class was not available " "directly." msgstr "" -#: ../../library/ctypes.rst:2933 +#: ../../library/ctypes.rst:2949 msgid "Name of the field, as a string." msgstr "" -#: ../../library/ctypes.rst:2937 +#: ../../library/ctypes.rst:2953 msgid "Type of the field, as a :ref:`ctypes class `." msgstr "" -#: ../../library/ctypes.rst:2942 +#: ../../library/ctypes.rst:2958 msgid "Offset of the field, in bytes." msgstr "" -#: ../../library/ctypes.rst:2944 +#: ../../library/ctypes.rst:2960 msgid "" "For bitfields, this is the offset of the underlying byte-aligned *storage " "unit*; see :attr:`~CField.bit_offset`." msgstr "" -#: ../../library/ctypes.rst:2949 +#: ../../library/ctypes.rst:2965 msgid "Size of the field, in bytes." msgstr "" -#: ../../library/ctypes.rst:2951 +#: ../../library/ctypes.rst:2967 msgid "" "For bitfields, this is the size of the underlying *storage unit*. Typically, " "it has the same size as the bitfield's type." msgstr "" -#: ../../library/ctypes.rst:2956 +#: ../../library/ctypes.rst:2972 msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." msgstr "" -#: ../../library/ctypes.rst:2958 +#: ../../library/ctypes.rst:2974 msgid "" "For bitfields, this contains a backwards-compatible bit-packed value that " "combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " "using the explicit attributes instead." msgstr "" -#: ../../library/ctypes.rst:2965 +#: ../../library/ctypes.rst:2981 msgid "True if this is a bitfield." msgstr "" -#: ../../library/ctypes.rst:2970 +#: ../../library/ctypes.rst:2986 msgid "" -"The location of a bitfield within its *storage unit*, that is, " -"within :attr:`~CField.byte_size` bytes of memory starting " -"at :attr:`~CField.byte_offset`." +"The location of a bitfield within its *storage unit*, that is, within :attr:" +"`~CField.byte_size` bytes of memory starting at :attr:`~CField.byte_offset`." msgstr "" -#: ../../library/ctypes.rst:2974 +#: ../../library/ctypes.rst:2990 msgid "" "To get the field's value, read the storage unit as an integer, :ref:`shift " "left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least " "significant bits." msgstr "" -#: ../../library/ctypes.rst:2978 +#: ../../library/ctypes.rst:2994 msgid "" "For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " "equal to ``byte_size * 8``." msgstr "" -#: ../../library/ctypes.rst:2983 +#: ../../library/ctypes.rst:2999 msgid "" "True if this field is anonymous, that is, it contains nested sub-fields that " "should be merged into a containing structure or union." msgstr "" -#: ../../library/ctypes.rst:2990 +#: ../../library/ctypes.rst:3006 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2994 +#: ../../library/ctypes.rst:3010 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2996 +#: ../../library/ctypes.rst:3012 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`." msgstr "" -#: ../../library/ctypes.rst:3006 +#: ../../library/ctypes.rst:3022 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:3013 +#: ../../library/ctypes.rst:3029 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:3016 +#: ../../library/ctypes.rst:3032 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:3021 +#: ../../library/ctypes.rst:3037 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:3025 +#: ../../library/ctypes.rst:3041 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:3031 +#: ../../library/ctypes.rst:3047 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:3033 +#: ../../library/ctypes.rst:3049 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:3037 +#: ../../library/ctypes.rst:3053 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:3047 +#: ../../library/ctypes.rst:3063 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:3051 +#: ../../library/ctypes.rst:3067 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." msgstr "" -#: ../../library/ctypes.rst:3058 +#: ../../library/ctypes.rst:3074 msgid "Exceptions" msgstr "" -#: ../../library/ctypes.rst:3062 +#: ../../library/ctypes.rst:3078 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:3068 +#: ../../library/ctypes.rst:3084 msgid "This exception is raised when a COM method call failed." msgstr "" -#: ../../library/ctypes.rst:3072 +#: ../../library/ctypes.rst:3088 msgid "The integer value representing the error code." msgstr "" -#: ../../library/ctypes.rst:3076 +#: ../../library/ctypes.rst:3092 msgid "The error message." msgstr "" -#: ../../library/ctypes.rst:3080 +#: ../../library/ctypes.rst:3096 msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." msgstr "" -#: ../../library/ctypes.rst:3082 +#: ../../library/ctypes.rst:3098 msgid "" "*descr* is the textual description. *source* is the language-dependent " "``ProgID`` for the class or application that raised the error. *helpfile* " diff --git a/library/curses.po b/library/curses.po index 10b29c30bb..119b139e4d 100644 --- a/library/curses.po +++ b/library/curses.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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-" @@ -183,9 +183,9 @@ msgstr "" msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " -"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the " -"other :const:`!A_\\*` attributes. :func:`pair_number` is the counterpart to " -"this function." +"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the other :const:" +"`!A_\\*` attributes. :func:`pair_number` is the counterpart to this " +"function." msgstr "" #: ../../library/curses.rst:133 @@ -201,16 +201,16 @@ msgstr "" msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " -"for when the program is not in curses.) Subsequent calls " -"to :func:`reset_prog_mode` will restore this mode." +"for when the program is not in curses.) Subsequent calls to :func:" +"`reset_prog_mode` will restore this mode." msgstr "" #: ../../library/curses.rst:150 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " -"mode, when the program is using curses capabilities.) Subsequent calls " -"to :func:`reset_shell_mode` will restore this mode." +"mode, when the program is using curses capabilities.) Subsequent calls to :" +"func:`reset_shell_mode` will restore this mode." msgstr "" #: ../../library/curses.rst:158 @@ -232,8 +232,8 @@ msgid "" "a window. The normal :meth:`~window.refresh` call is simply :meth:`!" "noutrefresh` followed by :func:`!doupdate`; if you have to update multiple " "windows, you can speed performance and perhaps reduce screen flicker by " -"issuing :meth:`!noutrefresh` calls on all windows, followed by a " -"single :func:`!doupdate`." +"issuing :meth:`!noutrefresh` calls on all windows, followed by a single :" +"func:`!doupdate`." msgstr "" #: ../../library/curses.rst:178 @@ -286,8 +286,10 @@ msgid "" "coordinates. (*z* is currently unused.) *bstate* is an integer value whose " "bits will be set to indicate the type of event, and will be the bitwise OR " "of one or more of the following constants, where *n* is the button number " -"from 1 to " -"5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." +"from 1 to 5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:" +"`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:" +"`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :" +"const:`BUTTON_ALT`." msgstr "" #: ../../library/curses.rst:230 ../../library/curses.rst:1799 @@ -305,9 +307,9 @@ msgstr "" #: ../../library/curses.rst:243 msgid "" -"Read window related data stored in the file by an " -"earlier :func:`window.putwin` call. The routine then creates and initializes " -"a new window using that data, returning the new window object." +"Read window related data stored in the file by an earlier :func:`window." +"putwin` call. The routine then creates and initializes a new window using " +"that data, returning the new window object." msgstr "" #: ../../library/curses.rst:250 @@ -374,10 +376,10 @@ msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " "background color number. The value of *pair_number* must be between ``1`` " -"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed " -"by :func:`use_default_colors` and :func:`assume_default_colors`). The value " -"of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, " -"after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed by :func:" +"`use_default_colors` and :func:`assume_default_colors`). The value of *fg* " +"and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, after " +"calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " "``-1``. If the color-pair was previously initialized, the screen is " "refreshed and all occurrences of that color-pair are changed to the new " "definition." @@ -471,14 +473,14 @@ msgid "" "and is not necessarily associated with a particular part of the screen. " "Pads can be used when a large window is needed, and only a part of the " "window will be on the screen at one time. Automatic refreshes of pads (such " -"as from scrolling or echoing of input) do not occur. " -"The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad " -"require 6 arguments to specify the part of the pad to be displayed and the " -"location on the screen to be used for the display. The arguments are " -"*pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* " -"arguments refer to the upper left corner of the pad region to be displayed " -"and the *s* arguments define a clipping box on the screen within which the " -"pad region is to be displayed." +"as from scrolling or echoing of input) do not occur. The :meth:`~window." +"refresh` and :meth:`~window.noutrefresh` methods of a pad require 6 " +"arguments to specify the part of the pad to be displayed and the location on " +"the screen to be used for the display. The arguments are *pminrow*, " +"*pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* arguments " +"refer to the upper left corner of the pad region to be displayed and the *s* " +"arguments define a clipping box on the screen within which the pad region is " +"to be displayed." msgstr "" #: ../../library/curses.rst:413 @@ -541,15 +543,15 @@ msgstr "" #: ../../library/curses.rst:468 msgid "" -"Return the number of the color-pair set by the attribute value " -"*attr*. :func:`color_pair` is the counterpart to this function." +"Return the number of the color-pair set by the attribute value *attr*. :func:" +"`color_pair` is the counterpart to this function." msgstr "" #: ../../library/curses.rst:474 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " -"terminfo capability for the current terminal. Note that the output " -"of :func:`putp` always goes to standard output." +"terminfo capability for the current terminal. Note that the output of :func:" +"`putp` always goes to standard output." msgstr "" #: ../../library/curses.rst:481 @@ -568,20 +570,20 @@ msgstr "" #: ../../library/curses.rst:495 msgid "" -"Restore the terminal to \"program\" mode, as previously saved " -"by :func:`def_prog_mode`." +"Restore the terminal to \"program\" mode, as previously saved by :func:" +"`def_prog_mode`." msgstr "" #: ../../library/curses.rst:501 msgid "" -"Restore the terminal to \"shell\" mode, as previously saved " -"by :func:`def_shell_mode`." +"Restore the terminal to \"shell\" mode, as previously saved by :func:" +"`def_shell_mode`." msgstr "" #: ../../library/curses.rst:507 msgid "" -"Restore the state of the terminal modes to what it was at the last call " -"to :func:`savetty`." +"Restore the state of the terminal modes to what it was at the last call to :" +"func:`savetty`." msgstr "" #: ../../library/curses.rst:513 @@ -603,8 +605,8 @@ msgstr "" #: ../../library/curses.rst:530 msgid "" -"Save the current state of the terminal modes in a buffer, usable " -"by :func:`resetty`." +"Save the current state of the terminal modes in a buffer, usable by :func:" +"`resetty`." msgstr "" #: ../../library/curses.rst:535 @@ -653,11 +655,11 @@ msgstr "" #: ../../library/curses.rst:581 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " -"yellow, blue, magenta, cyan, and white), and two global variables in " -"the :mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, " -"containing the maximum number of colors and color-pairs the terminal can " -"support. It also restores the colors on the terminal to the values they had " -"when the terminal was just turned on." +"yellow, blue, magenta, cyan, and white), and two global variables in the :" +"mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, containing " +"the maximum number of colors and color-pairs the terminal can support. It " +"also restores the colors on the terminal to the values they had when the " +"terminal was just turned on." msgstr "" #: ../../library/curses.rst:590 @@ -846,8 +848,8 @@ msgstr "" #: ../../library/curses.rst:775 msgid "" -"Add attribute *attr* from the \"background\" set applied to all writes to " -"the current window." +"Add attribute *attr* to the \"background\" set applied to all writes to the " +"current window." msgstr "" #: ../../library/curses.rst:781 @@ -1065,8 +1067,8 @@ msgstr "" #: ../../library/curses.rst:910 msgid "" -"Add character *ch* with attribute *attr*, and immediately " -"call :meth:`refresh` on the window." +"Add character *ch* with attribute *attr*, and immediately call :meth:" +"`refresh` on the window." msgstr "" #: ../../library/curses.rst:916 @@ -1236,15 +1238,15 @@ msgstr "" #: ../../library/curses.rst:1096 msgid "" -"Return ``True`` if the specified line was modified since the last call " -"to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " +"Return ``True`` if the specified line was modified since the last call to :" +"meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" #: ../../library/curses.rst:1103 msgid "" -"Return ``True`` if the specified window was modified since the last call " -"to :meth:`refresh`; otherwise return ``False``." +"Return ``True`` if the specified window was modified since the last call to :" +"meth:`refresh`; otherwise return ``False``." msgstr "" #: ../../library/curses.rst:1109 @@ -1313,8 +1315,8 @@ msgstr "" #: ../../library/curses.rst:1167 msgid "" -"To get fine-grained control over the copied region, the second form " -"of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form of :meth:" +"`overlay` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, and the other variables mark a rectangle " "in the destination window." msgstr "" @@ -1329,8 +1331,8 @@ msgstr "" #: ../../library/curses.rst:1180 msgid "" -"To get fine-grained control over the copied region, the second form " -"of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form of :meth:" +"`overwrite` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, the other variables mark a rectangle in " "the destination window." msgstr "" @@ -1349,8 +1351,8 @@ msgstr "" #: ../../library/curses.rst:1200 msgid "" -"Touch the entire window, causing it to be completely redrawn on the " -"next :meth:`refresh` call." +"Touch the entire window, causing it to be completely redrawn on the next :" +"meth:`refresh` call." msgstr "" #: ../../library/curses.rst:1206 @@ -1448,9 +1450,9 @@ msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " "If *delay* is zero, then non-blocking read is used, and :meth:`getch` will " -"return ``-1`` if no input is waiting. If *delay* is positive, " -"then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if " -"there is still no input at the end of that time." +"return ``-1`` if no input is waiting. If *delay* is positive, then :meth:" +"`getch` will block for *delay* milliseconds, and return ``-1`` if there is " +"still no input at the end of that time." msgstr "" #: ../../library/curses.rst:1309 @@ -1469,8 +1471,8 @@ msgstr "" #: ../../library/curses.rst:1322 msgid "" -"Mark all lines in the window as unchanged since the last call " -"to :meth:`refresh`." +"Mark all lines in the window as unchanged since the last call to :meth:" +"`refresh`." msgstr "" #: ../../library/curses.rst:1329 @@ -1489,8 +1491,8 @@ msgstr ":mod:`curses` 模組定義了以下資料成員:" #: ../../library/curses.rst:1341 msgid "" -"Some curses routines that return an integer, such " -"as :meth:`~window.getch`, return :const:`ERR` upon failure." +"Some curses routines that return an integer, such as :meth:`~window." +"getch`, return :const:`ERR` upon failure." msgstr "" #: ../../library/curses.rst:1347 @@ -1530,15 +1532,15 @@ msgstr "" #: ../../library/curses.rst:1380 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " -"after the call to :func:`initscr`. Updated " -"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" +"func:`resizeterm` and :func:`resize_term`." msgstr "" #: ../../library/curses.rst:1387 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " -"after the call to :func:`initscr`. Updated " -"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" +"func:`resizeterm` and :func:`resize_term`." msgstr "" #: ../../library/curses.rst:1393 @@ -1626,7 +1628,7 @@ msgstr "" #: ../../library/curses.rst:1435 msgid "``A_ITALIC`` was added." -msgstr "" +msgstr "新增 ``A_ITALIC``。" #: ../../library/curses.rst:1438 msgid "" @@ -2043,14 +2045,13 @@ msgstr "" #: ../../library/curses.rst:1652 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " -"are normally at least four function keys (:const:`KEY_F1 " -"`, :const:`KEY_F2 `, :const:`KEY_F3 " -"`, :const:`KEY_F4 `) available, and the arrow keys mapped " -"to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` " -"and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC " -"keyboard, it is safe to expect arrow keys and twelve function keys (older PC " -"keyboards may have only ten function keys); also, the following keypad " -"mappings are standard:" +"are normally at least four function keys (:const:`KEY_F1 `, :const:" +"`KEY_F2 `, :const:`KEY_F3 `, :const:`KEY_F4 `) " +"available, and the arrow keys mapped to :const:`KEY_UP`, :const:`KEY_DOWN`, :" +"const:`KEY_LEFT` and :const:`KEY_RIGHT` in the obvious way. If your machine " +"has a PC keyboard, it is safe to expect arrow keys and twelve function keys " +"(older PC keyboards may have only ten function keys); also, the following " +"keypad mappings are standard:" msgstr "" #: ../../library/curses.rst:1661 @@ -2415,11 +2416,11 @@ msgstr "" #: ../../library/curses.rst:1866 msgid "" -"Return a textbox widget object. The *win* argument should be a " -"curses :ref:`window ` object in which the textbox is " -"to be contained. The edit cursor of the textbox is initially located at the " -"upper left hand corner of the containing window, with coordinates ``(0, " -"0)``. The instance's :attr:`stripspaces` flag is initially on." +"Return a textbox widget object. The *win* argument should be a curses :ref:" +"`window ` object in which the textbox is to be " +"contained. The edit cursor of the textbox is initially located at the upper " +"left hand corner of the containing window, with coordinates ``(0, 0)``. The " +"instance's :attr:`stripspaces` flag is initially on." msgstr "" #: ../../library/curses.rst:1872 @@ -2433,8 +2434,8 @@ msgid "" "*validator* is supplied, it must be a function. It will be called for each " "keystroke entered with the keystroke as a parameter; command dispatch is " "done on the result. This method returns the window contents as a string; " -"whether blanks in the window are included is affected by " -"the :attr:`stripspaces` attribute." +"whether blanks in the window are included is affected by the :attr:" +"`stripspaces` attribute." msgstr "" #: ../../library/curses.rst:1888 diff --git a/library/dataclasses.po b/library/dataclasses.po index 9eeb64a381..af92b95301 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-10-08 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-" @@ -27,9 +27,9 @@ msgstr "**原始碼:**\\ :source:`Lib/dataclasses.py`" #, fuzzy msgid "" "This module provides a decorator and functions for automatically adding " -"generated :term:`special methods ` such " -"as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined " -"classes. It was originally described in :pep:`557`." +"generated :term:`special methods ` such as :meth:`~object." +"__init__` and :meth:`~object.__repr__` to user-defined classes. It was " +"originally described in :pep:`557`." msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/dataclasses.rst:19 #, fuzzy msgid "" -"The member variables to use in these generated methods are defined " -"using :pep:`526` type annotations. For example, this code::" +"The member variables to use in these generated methods are defined using :" +"pep:`526` type annotations. For example, this code::" msgstr "" "在這些生成的方法中使用的成員變數是使用 :pep:`526` 型別註釋定義的。例如,這段" "程式碼: ::" @@ -94,9 +94,8 @@ msgstr "模組內容" #: ../../library/dataclasses.rst:51 #, fuzzy msgid "" -"This function is a :term:`decorator` that is used to add " -"generated :term:`special methods ` to classes, as described " -"below." +"This function is a :term:`decorator` that is used to add generated :term:" +"`special methods ` to classes, as described below." msgstr "" "此函式是一個 :term:`decorator`,用於將生成的\\ :term:`特殊方法 `\\新增到類別中,如下所述。" @@ -109,9 +108,9 @@ 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`` 中沒有任何內容檢查變數註釋中指定的型別。" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" +"term:`type annotation ` 的類別變數。除了下面描述的兩個例" +"外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 #, fuzzy @@ -226,35 +225,32 @@ msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽 #: ../../library/dataclasses.rst:113 #, fuzzy msgid "" -"*order*: If true (the default is " -"``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"and :meth:`~object.__ge__` methods will be generated. These compare the " -"class as if it were a tuple of its fields, in order. Both instances in the " -"comparison must be of the identical type. If *order* is true and *eq* is " -"false, a :exc:`ValueError` is raised." +"*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" +"`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods " +"will be generated. These compare the class as if it were a tuple of its " +"fields, in order. Both instances in the comparison must be of the identical " +"type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." msgstr "" -"*order*:如果為真(預設為 " -"``False``),:meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"和 :meth:`~object.__ge__` 方法將是產生。它們按順序比較類別,就好像它是其欄位" -"的元組一樣。比較中的兩個實例必須屬於同一型別。如果 *order* 為真且 *eq* 為假," -"則會引發 :exc:`ValueError`。" +"*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" +"`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" +"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" +"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 msgid "" -"If the class already defines any of :meth:`!__lt__`, :meth:`!" -"__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is " -"raised." +"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:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" +"meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 #, fuzzy msgid "" -"*unsafe_hash*: If true, force ``dataclasses`` to create " -"a :meth:`~object.__hash__` method, even though it may not be safe to do so. " -"Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* " -"and *frozen* are set. The default value is ``False``." +"*unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object." +"__hash__` method, even though it may not be safe to do so. Otherwise, " +"generate a :meth:`~object.__hash__` method according to how *eq* and " +"*frozen* are set. The default value is ``False``." msgstr "" "*unsafe_hash*:如果 ``False``(預設值),將根據 *eq* 和 *frozen* 的設定生成一" "個 :meth:`~object.__hash__` 方法。" @@ -277,11 +273,11 @@ msgstr "" #: ../../library/dataclasses.rst:137 #, fuzzy msgid "" -"By default, ``@dataclass`` will not implicitly add " -"a :meth:`~object.__hash__` method unless it is safe to do so. Neither will " -"it add or change an existing explicitly defined :meth:`!__hash__` method. " -"Setting the class attribute ``__hash__ = None`` has a specific meaning to " -"Python, as described in the :meth:`!__hash__` documentation." +"By default, ``@dataclass`` will not implicitly add a :meth:`~object." +"__hash__` method unless it is safe to do so. Neither will it add or change " +"an existing explicitly defined :meth:`!__hash__` method. Setting the class " +"attribute ``__hash__ = None`` has a specific meaning to Python, as described " +"in the :meth:`!__hash__` documentation." msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" @@ -309,35 +305,35 @@ msgstr "" msgid "" "Here are the rules governing implicit creation of a :meth:`!__hash__` " "method. Note that you cannot both have an explicit :meth:`!__hash__` method " -"in your dataclass and set ``unsafe_hash=True``; this will result in " -"a :exc:`TypeError`." +"in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:" +"`TypeError`." msgstr "" "以下是管理隱式建立 :meth:`!__hash__` 方法的規則。請注意,你不能在資料類別中既" -"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導" -"致 :exc:`TypeError`。" +"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導致 :exc:" +"`TypeError`。" #: ../../library/dataclasses.rst:155 msgid "" "If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " -"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is " -"false, :meth:`!__hash__` will be set to ``None``, marking it unhashable " -"(which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` " -"will be left untouched meaning the :meth:`!__hash__` method of the " -"superclass will be used (if the superclass is :class:`object`, this means it " -"will fall back to id-based hashing)." -msgstr "" -"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一" -"個 :meth:`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` " -"將被設定為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 *eq* 為" -"假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!__hash__` 方" -"法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :" +"meth:`!__hash__` will be set to ``None``, marking it unhashable (which it " +"is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left " +"untouched meaning the :meth:`!__hash__` method of the superclass will be " +"used (if the superclass is :class:`object`, this means it will fall back to " +"id-based hashing)." +msgstr "" +"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個 :meth:" +"`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` 將被設定" +"為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 *eq* 為假,:meth:`!" +"__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!__hash__` 方法(如果超類" +"別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" #: ../../library/dataclasses.rst:163 #, fuzzy msgid "" "*frozen*: If true (the default is ``False``), assigning to fields will " -"generate an exception. This emulates read-only frozen instances. See " -"the :ref:`discussion ` below." +"generate an exception. This emulates read-only frozen instances. See the :" +"ref:`discussion ` below." msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" @@ -354,11 +350,11 @@ msgstr "" #: ../../library/dataclasses.rst:170 #, fuzzy msgid "" -"*match_args*: If true (the default is ``True``), " -"the :attr:`~object.__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*: If true (the default is ``True``), the :attr:`~object." +"__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__`` 元組將從參數列" @@ -377,10 +373,10 @@ msgid "" "the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" -"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成" -"的 :meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對" -"資料類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙" -"表條目。另請參閱 :const:`KW_ONLY` 部分。" +"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" +"meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對資料" +"類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" +"目。另請參閱 :const:`KW_ONLY` 部分。" #: ../../library/dataclasses.rst:187 msgid "Keyword-only fields are not included in :attr:`!__match_args__`." @@ -391,8 +387,8 @@ msgstr "" msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " "attribute will be generated and new class will be returned instead of the " -"original one. If :attr:`!__slots__` is already defined in the class, " -"then :exc:`TypeError` is raised." +"original one. If :attr:`!__slots__` is already defined in the class, then :" +"exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " "屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," @@ -412,9 +408,9 @@ msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " "class, it will not be included in the generated :attr:`!__slots__` to " "prevent :ref:`overriding them `. Therefore, do not " -"use :attr:`!__slots__` to retrieve the field names of a dataclass. " -"Use :func:`fields` instead. To be able to determine inherited slots, base " -"class :attr:`!__slots__` may be any iterable, but *not* an iterator." +"use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:" +"`fields` instead. To be able to determine inherited slots, base class :attr:" +"`!__slots__` may be any iterable, but *not* an iterator." msgstr "" "如果欄位名稱已經包含在基底類別的 :attr:`!__slots__` 中,它將不會包含在生成" "的 :attr:`!__slots__` 中以防止 :ref:`覆蓋它們 `。因此," @@ -455,8 +451,8 @@ msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " "added :meth:`~object.__init__` method, which will be defined as::" msgstr "" -"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增" -"的 :meth:`~object.__init__` 方法中,該方法將定義為: ::" +"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." +"__init__` 方法中,該方法將定義為: ::" #: ../../library/dataclasses.rst:234 msgid "def __init__(self, a: int, b: int = 0):" @@ -568,10 +564,10 @@ msgid "" "comparisons. Setting this value to anything other than ``None`` is " "discouraged." msgstr "" -"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成" -"的 :meth:`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的" -"值:這通常是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵" -"將此值設定為 ``None`` 以外的任何值。" +"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" +"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" +"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" +"為 ``None`` 以外的任何值。" #: ../../library/dataclasses.rst:286 #, fuzzy @@ -590,11 +586,11 @@ msgstr "" #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " -"equality and comparison methods " -"(:meth:`~object.__eq__`, :meth:`~object.__gt__`, et al.)." +"equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object." +"__gt__`, et al.)." msgstr "" -"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中" -"(:meth:`~object.__eq__`、:meth:`~object.__gt__` 等)。" +"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" +"`~object.__eq__`、:meth:`~object.__gt__` 等)。" #: ../../library/dataclasses.rst:296 #, fuzzy @@ -606,10 +602,10 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含" -"在 :func:`~types.MappingProxyType` 中以使其成為只讀的,並暴露" -"在 :class:`Field` 對像上。它根本不被資料類別使用,而是作為第三方擴充機制提供" -"的。多個第三方可以各自擁有自己的密鑰,用作元資料中的命名空間。" +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." +"MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" +"不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" +"密鑰,用作元資料中的命名空間。" #: ../../library/dataclasses.rst:304 #, fuzzy @@ -617,8 +613,8 @@ msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " "when the generated :meth:`~object.__init__` method's parameters are computed." msgstr "" -"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成" -"的 :meth:`~object.__init__` 方法的參數時使用。" +"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成的 :meth:" +"`~object.__init__` 方法的參數時使用。" #: ../../library/dataclasses.rst:308 msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." @@ -634,10 +630,10 @@ msgid "" "If the default value of a field is specified by a call to :func:`!field`, " "then the class attribute for this field will be replaced by the specified " "*default* value. If *default* is not provided, then the class attribute " -"will be deleted. The intent is that after the :func:`@dataclass " -"` decorator runs, the class attributes will all contain the " -"default values for the fields, just as if the default value itself were " -"specified. For example, after::" +"will be deleted. The intent is that after the :deco:`dataclass` decorator " +"runs, the class attributes will all contain the default values for the " +"fields, just as if the default value itself were specified. For example, " +"after::" msgstr "" "如果欄位的預設值是通過呼叫 :func:`!field` 指定的,那麼該欄位的類別屬性將被指" "定的 *default* 值替換。如果沒有提供 *default*,那麼類別屬性將被刪除。目的是" @@ -678,9 +674,9 @@ msgid "" "method (see below). Users should never instantiate a :class:`!Field` object " "directly. Its documented attributes are:" msgstr "" -":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並" -"由 :func:`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!" -"Field` 物件。它記錄的屬性是:" +":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並由 :func:" +"`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" +"件。它記錄的屬性是:" #: ../../library/dataclasses.rst:343 msgid ":attr:`!name`: The name of the field." @@ -693,14 +689,13 @@ msgstr ":attr:`!type`:欄位的型別。" #: ../../library/dataclasses.rst:345 #, fuzzy msgid "" -":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!" -"repr`, :attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!" -"kw_only` have the identical meaning and values as they do in " -"the :func:`field` function." +":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" +"attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have " +"the identical meaning and values as they do in the :func:`field` function." msgstr "" -":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!" -"repr`、:attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!" -"kw_only` 有與它們在 :func:`field` 函式中的含義和值相同。" +":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!repr`、:" +"attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" +"們在 :func:`field` 函式中的含義和值相同。" #: ../../library/dataclasses.rst:349 #, fuzzy @@ -713,9 +708,9 @@ msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴 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__`." +"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:363 @@ -803,8 +798,8 @@ msgid "" "objects are copied with :func:`copy.deepcopy`." msgstr "" "將資料類別 *obj* 轉換為元組(通過使用工廠函式 *tuple_factory*)。每個資料類別" -"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使" -"用 :func:`copy.deepcopy` 複製。" +"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" +"func:`copy.deepcopy` 複製。" #: ../../library/dataclasses.rst:408 msgid "Continuing from the previous example::" @@ -839,8 +834,8 @@ msgid "" "``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " "supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " "*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " -"*slots*, and *weakref_slot* have the same meaning as they do " -"in :func:`@dataclass `." +"*slots*, and *weakref_slot* have the same meaning as they do in :deco:" +"`dataclass`." msgstr "" "建立一個名為 *cls_name* 的新資料類別,欄位在 *fields* 中定義,基底類別在 " "*bases* 中給出,並使用 *namespace* 中給出的命名空間進行初始化。 ``fields`` 是" @@ -860,8 +855,8 @@ msgstr "" msgid "" "The *decorator* parameter is a callable that will be used to create the " "dataclass. It should take the class object as a first argument and the same " -"keyword arguments as :func:`@dataclass `. By default, " -"the :func:`@dataclass ` function is used." +"keyword arguments as :deco:`dataclass`. By default, the :deco:`dataclass` " +"function is used." msgstr "" #: ../../library/dataclasses.rst:441 @@ -869,12 +864,12 @@ msgstr "" msgid "" "This function is not strictly required, because any Python mechanism for " "creating a new class with :attr:`~object.__annotations__` can then apply " -"the :func:`@dataclass ` function to convert that class to a " -"dataclass. This function is provided as a convenience. For example::" +"the :deco:`dataclass` function to convert that class to a dataclass. This " +"function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 :attr:`~object.__annotations__` 建立新類別的 Python " -"機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" -"方便。例如: ::" +"這個函式不是嚴格要求的,因為任何使用 :attr:`~object.__annotations__` 建立新類" +"別的 Python 機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供" +"此功能是為了方便。例如: ::" #: ../../library/dataclasses.rst:447 msgid "" @@ -915,8 +910,8 @@ msgstr "" msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " "from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " -"keys in *changes* are not field names of the given dataclass, " -"raises :exc:`TypeError`." +"keys in *changes* are not field names of the given dataclass, raises :exc:" +"`TypeError`." msgstr "" "建立一個與 ``obj`` 型別相同的新物件,用 ``changes`` 中的值替換欄位。如果 " "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" @@ -970,17 +965,16 @@ msgstr "" #: ../../library/dataclasses.rst:495 msgid "" -"Dataclass instances are also supported by generic " -"function :func:`copy.replace`." +"Dataclass instances are also supported by generic function :func:`copy." +"replace`." msgstr "" #: ../../library/dataclasses.rst:499 -#, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " "dataclass) or an instance of one, otherwise return ``False``." msgstr "" -"如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" +"如果它的參數是一個資料類別(包含一個資料類別的子類別)或一個實例則回傳 ``True``,否則回傳 ``False``。" #: ../../library/dataclasses.rst:502 #, fuzzy @@ -1010,9 +1004,9 @@ msgid "" "with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " "that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " "ignored. This includes the name of such a field. By convention, a name of " -"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields " -"signify :meth:`~object.__init__` parameters that must be specified as " -"keywords when the class is instantiated." +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :" +"meth:`~object.__init__` parameters that must be specified as keywords when " +"the class is instantiated." msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" @@ -1056,33 +1050,33 @@ msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的 #: ../../library/dataclasses.rst:542 #, fuzzy msgid "" -"Raised when an implicitly defined :meth:`~object.__setattr__` " -"or :meth:`~object.__delattr__` is called on a dataclass which was defined " -"with ``frozen=True``. It is a subclass of :exc:`AttributeError`." +"Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" +"`~object.__delattr__` is called on a dataclass which was defined with " +"``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" -"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` " -"或 :meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" +"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" +"meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" #: ../../library/dataclasses.rst:549 #, fuzzy msgid "Post-init processing" -msgstr "初始化後處理" +msgstr "後初始化處理" #: ../../library/dataclasses.rst:553 #, fuzzy msgid "" -"When defined on the class, it will be called by the " -"generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. " -"However, if any ``InitVar`` fields are defined, they will also be passed " -"to :meth:`!__post_init__` in the order they were defined in the class. If " -"no :meth:`!__init__` method is generated, then :meth:`!__post_init__` will " -"not automatically be called." +"When defined on the class, it will be called by the generated :meth:`~object." +"__init__`, normally as :meth:`!self.__post_init__`. However, if any " +"``InitVar`` fields are defined, they will also be passed to :meth:`!" +"__post_init__` in the order they were defined in the class. If no :meth:`!" +"__init__` method is generated, then :meth:`!__post_init__` will not " +"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__` 將不會被自動呼叫。" +"生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." +"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" +"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" +"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" +"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" #: ../../library/dataclasses.rst:560 #, fuzzy @@ -1114,10 +1108,10 @@ msgstr "" #: ../../library/dataclasses.rst:572 #, fuzzy msgid "" -"The :meth:`~object.__init__` method generated by :func:`@dataclass " -"` does not call base class :meth:`!__init__` methods. If the base " -"class has an :meth:`!__init__` method that has to be called, it is common to " -"call this method in a :meth:`__post_init__` method::" +"The :meth:`~object.__init__` method generated by :deco:`dataclass` does not " +"call base class :meth:`!__init__` methods. If the base class has an :meth:`!" +"__init__` method that has to be called, it is common to call this method in " +"a :meth:`__post_init__` method::" msgstr "" ":func:`@dataclass ` 生成的 :meth:`~object.__init__` 方法不呼叫基底" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " @@ -1162,8 +1156,8 @@ msgstr "" #: ../../library/dataclasses.rst:593 #, fuzzy msgid "" -"See the section below on init-only variables for ways to pass parameters " -"to :meth:`!__post_init__`. Also see the warning about how :func:`replace` " +"See the section below on init-only variables for ways to pass parameters to :" +"meth:`!__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" @@ -1176,19 +1170,18 @@ msgstr "類別變數" #: ../../library/dataclasses.rst:602 #, fuzzy msgid "" -"One of the few places where :func:`@dataclass ` actually inspects " -"the type of a field is to determine if a field is a class variable as " -"defined in :pep:`526`. It does this by checking if the type of the field " -"is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded " -"from consideration as a field and is ignored by the dataclass mechanisms. " -"Such ``ClassVar`` pseudo-fields are not returned by the module-" -"level :func:`fields` function." +"One of the few places where :deco:`dataclass` actually inspects the type of " +"a field is to determine if a field is a class variable as defined in :pep:" +"`526`. It does this by checking if the type of the field is :data:`typing." +"ClassVar`. If a field is a ``ClassVar``, it is excluded from consideration " +"as a field and is ignored by the dataclass mechanisms. Such ``ClassVar`` " +"pseudo-fields are not returned by the module-level :func:`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否" -"為 :data:`typing.ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它" -"就被排除在考慮之外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳" -"此類別 ``ClassVar`` 偽欄位。" +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." +"ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" +"外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " +"``ClassVar`` 偽欄位。" #: ../../library/dataclasses.rst:613 #, fuzzy @@ -1198,15 +1191,14 @@ msgstr "僅初始化變數" #: ../../library/dataclasses.rst:615 #, 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 :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 " -"optional :meth:`__post_init__` method. They are not otherwise used by " -"dataclasses." +"Another place where :deco:`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 :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 optional :meth:" +"`__post_init__` method. They are not otherwise used by dataclasses." msgstr "" ":func:`dataclass` 檢查型別註解的另一個地方是確定欄位是否是僅初始化變數。它通" "過查看欄位的型別是否為 ``dataclasses.InitVar`` 型別來執行此操作。如果一個欄位" @@ -1254,8 +1246,8 @@ msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" "i` and :attr:`!j`, but not for :attr:`!database`." msgstr "" -"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回" -"傳 :class:`Field` 物件,但不會為 :attr:`!database` 回傳。" +"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" +"`Field` 物件,但不會為 :attr:`!database` 回傳。" #: ../../library/dataclasses.rst:646 msgid "Frozen instances" @@ -1265,24 +1257,22 @@ msgstr "凍結實例" #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " -"passing ``frozen=True`` to the :func:`@dataclass ` decorator you " -"can emulate immutability. In that case, dataclasses will " -"add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to " -"the class. These methods will raise a :exc:`FrozenInstanceError` when " -"invoked." -msgstr "" -"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞" -"給 :func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資" -"料類別將向類別新增 :meth:`~object.__setattr__` " -"和 :meth:`~object.__delattr__` 方法。這些方法在叫用時會引" -"發 :exc:`FrozenInstanceError`。" +"passing ``frozen=True`` to the :deco:`dataclass` decorator you can emulate " +"immutability. In that case, dataclasses will add :meth:`~object." +"__setattr__` and :meth:`~object.__delattr__` methods to the class. These " +"methods will raise a :exc:`FrozenInstanceError` when invoked." +msgstr "" +"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" +"func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" +"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" +"法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" #: ../../library/dataclasses.rst:654 #, fuzzy msgid "" -"There is a tiny performance penalty when using " -"``frozen=True``: :meth:`~object.__init__` cannot use simple assignment to " -"initialize fields, and must use :meth:`!object.__setattr__`." +"There is a tiny performance penalty when using ``frozen=True``: :meth:" +"`~object.__init__` cannot use simple assignment to initialize fields, and " +"must use :meth:`!object.__setattr__`." msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" @@ -1294,14 +1284,14 @@ msgstr "繼承" #: ../../library/dataclasses.rst:665 #, fuzzy msgid "" -"When the dataclass is being created by the :func:`@dataclass ` " -"decorator, it looks through all of the class's base classes in reverse MRO " -"(that is, starting at :class:`object`) and, for each dataclass that it " -"finds, adds the fields from that base class to an ordered mapping of fields. " -"After all of the base class fields are added, it adds its own fields to the " -"ordered mapping. All of the generated methods will use this combined, " -"calculated ordered mapping of fields. Because the fields are in insertion " -"order, derived classes override base classes. An example::" +"When the dataclass is being created by the :deco:`dataclass` decorator, it " +"looks through all of the class's base classes in reverse MRO (that is, " +"starting at :class:`object`) and, for each dataclass that it finds, adds the " +"fields from that base class to an ordered mapping of fields. After all of " +"the base class fields are added, it adds its own fields to the ordered " +"mapping. All of the generated methods will use this combined, calculated " +"ordered mapping of fields. Because the fields are in insertion order, " +"derived classes override base classes. An example::" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" "從 :class:`object` 開始)查看該類別的所有基底類別,並且對於它找到的每個資料類" @@ -1463,9 +1453,8 @@ msgid "" "initial value." msgstr "" "如果一個欄位從 :meth:`~object.__init__` 中排除(使用 ``init=False``)並且該欄" -"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成" -"的 :meth:`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦" -"予初始值。" +"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" +"`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" #: ../../library/dataclasses.rst:744 msgid "Mutable default values" @@ -1517,7 +1506,7 @@ msgstr "" #: ../../library/dataclasses.rst:764 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" -msgstr "使用資料類別,*如果*此程式碼有效: ::" +msgstr "使用資料類別,*如果*\\ 此程式碼有效: ::" #: ../../library/dataclasses.rst:766 msgid "" @@ -1561,14 +1550,14 @@ msgstr "" #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " -"That is, two instances of class :class:`!D` that do not specify a value " -"for :attr:`!x` when creating a class instance will share the same copy " -"of :attr:`!x`. Because dataclasses just use normal Python class creation " -"they also share this behavior. There is no general way for Data Classes to " -"detect this condition. Instead, the :func:`@dataclass ` " -"decorator will raise a :exc:`ValueError` if it detects an unhashable default " -"parameter. The assumption is that if a value is unhashable, it is mutable. " -"This is a partial solution, but it does protect against many common errors." +"That is, two instances of class :class:`!D` that do not specify a value for :" +"attr:`!x` when creating a class instance will share the same copy of :attr:`!" +"x`. Because dataclasses just use normal Python class creation they also " +"share this behavior. There is no general way for Data Classes to detect " +"this condition. Instead, the :deco:`dataclass` decorator will raise a :exc:" +"`ValueError` if it detects an unhashable default parameter. The assumption " +"is that if a value is unhashable, it is mutable. This is a partial " +"solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" "D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " @@ -1601,10 +1590,9 @@ msgstr "" #: ../../library/dataclasses.rst:803 #, fuzzy msgid "" -"Instead of looking for and disallowing objects of " -"type :class:`list`, :class:`dict`, or :class:`set`, unhashable objects are " -"now not allowed as default values. Unhashability is used to approximate " -"mutability." +"Instead of looking for and disallowing objects of type :class:`list`, :class:" +"`dict`, or :class:`set`, unhashable objects are now not allowed as default " +"values. Unhashability is used to approximate mutability." msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" @@ -1629,15 +1617,15 @@ msgid "" "method is passed to the descriptor's :meth:`~object.__set__` method rather " "than overwriting the descriptor object." msgstr "" -"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器" -"的 :meth:`~object.__set__` 方法,而不是覆蓋描述器物件。" +"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" +"`~object.__set__` 方法,而不是覆蓋描述器物件。" #: ../../library/dataclasses.rst:819 #, fuzzy msgid "" -"Similarly, when getting or setting the field, the " -"descriptor's :meth:`~object.__get__` or :meth:`!__set__` method is called " -"rather than returning or overwriting the descriptor object." +"Similarly, when getting or setting the field, the descriptor's :meth:" +"`~object.__get__` or :meth:`!__set__` method is called rather than returning " +"or overwriting the descriptor object." msgstr "" "同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" @@ -1645,12 +1633,12 @@ msgstr "" #: ../../library/dataclasses.rst:823 #, fuzzy msgid "" -"To determine whether a field contains a default value, :func:`@dataclass " -"` will call the descriptor's :meth:`!__get__` method using its " -"class access form: ``descriptor.__get__(obj=None, type=cls)``. If the " -"descriptor returns a value in this case, it will be used as the field's " -"default. On the other hand, if the descriptor raises :exc:`AttributeError` " -"in this situation, no default value will be provided for the field." +"To determine whether a field contains a default value, :deco:`dataclass` " +"will call the descriptor's :meth:`!__get__` method using its class access " +"form: ``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns " +"a value in this case, it will be used as the field's 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, " diff --git a/library/datetime.po b/library/datetime.po index 1185a7c712..b564fbec70 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -443,6 +443,16 @@ msgid "" ">>> pretty_timedelta(d)\n" "'-(1:00:00)'" msgstr "" +">>> def pretty_timedelta(td):\n" +"... if td.days >= 0:\n" +"... return str(td)\n" +"... return f'-({-td!s})'\n" +"...\n" +">>> d = timedelta(hours=-1)\n" +">>> str(d) # not human-friendly\n" +"'-1 day, 23:00:00'\n" +">>> pretty_timedelta(d)\n" +"'-(1:00:00)'" #: ../../library/datetime.rst:281 ../../library/datetime.rst:615 #: ../../library/datetime.rst:1175 ../../library/datetime.rst:1813 @@ -995,6 +1005,12 @@ msgid "" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" +">>> from datetime import date\n" +">>> date_string = \"02/29\"\n" +">>> when = date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # 避免" +"閏年錯誤。\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" #: ../../library/datetime.rst:619 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." @@ -1809,6 +1825,12 @@ msgid "" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" +">>> from datetime import datetime\n" +">>> date_string = \"02/29\"\n" +">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"避免閏年錯誤。\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" #: ../../library/datetime.rst:1179 msgid "" @@ -2324,6 +2346,16 @@ msgid "" ">>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()\n" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" +">>> from datetime import tzinfo, timedelta, datetime\n" +">>> class TZ(tzinfo):\n" +"... \"\"\"A time zone with an arbitrary, constant -06:39 offset.\"\"\"\n" +"... def utcoffset(self, dt):\n" +"... return timedelta(hours=-6, minutes=-39)\n" +"...\n" +">>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')\n" +"'2002-12-25 00:00:00-06:39'\n" +">>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()\n" +"'2009-11-27T00:00:00.000100-06:39'" #: ../../library/datetime.rst:1591 ../../library/datetime.rst:1982 msgid "" @@ -4368,6 +4400,10 @@ msgid "" "bug.\n" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" +">>> month_day = \"02/29\"\n" +">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # 沒有閏年" +"問題。\n" +"datetime.datetime(1984, 2, 29, 0, 0)" #: ../../library/datetime.rst:2778 msgid "" diff --git a/library/dbm.po b/library/dbm.po index 7dfd3dbb89..c7d077cc8f 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, " -"or :mod:`dbm.dumb` --- should be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" +"`dbm.dumb` --- should be used to open a given file." msgstr "" #: ../../library/dbm.rst:35 @@ -82,7 +82,7 @@ msgid "" "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 +#: ../../library/dbm.rst:41 ../../library/dbm.rst:270 ../../library/dbm.rst:471 msgid "*filename* accepts a :term:`path-like object`." msgstr "" @@ -96,13 +96,13 @@ msgstr "參數" #: ../../library/dbm.rst:67 msgid "" -"The database file to open. If the database file already exists, " -"the :func:`whichdb` function is used to determine its type and the " -"appropriate module is used; if it does not exist, the first submodule listed " -"above that can be imported is used." +"The database file to open. If the database file already exists, the :func:" +"`whichdb` function is used to determine its type and the appropriate module " +"is used; if it does not exist, the first submodule listed above that can be " +"imported is used." msgstr "" -#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 +#: ../../library/dbm.rst:68 ../../library/dbm.rst:242 msgid "The database file to open." msgstr "要打開的資料庫檔案" @@ -113,7 +113,7 @@ msgid "" "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 +#: ../../library/dbm.rst:75 ../../library/dbm.rst:182 ../../library/dbm.rst:374 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -121,28 +121,28 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 -#: ../../library/dbm.rst:354 +#: ../../library/dbm.rst:76 ../../library/dbm.rst:184 ../../library/dbm.rst:247 +#: ../../library/dbm.rst:375 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 -#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:185 ../../library/dbm.rst:248 +#: ../../library/dbm.rst:376 ../../library/dbm.rst:452 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 -#: ../../library/dbm.rst:356 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:186 ../../library/dbm.rst:249 +#: ../../library/dbm.rst:377 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 -#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:187 ../../library/dbm.rst:250 +#: ../../library/dbm.rst:378 ../../library/dbm.rst:454 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 -#: ../../library/dbm.rst:433 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:264 ../../library/dbm.rst:380 +#: ../../library/dbm.rst:456 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" @@ -152,51 +152,56 @@ msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" #: ../../library/dbm.rst:87 msgid "" -"The object returned by :func:`~dbm.open` supports the same basic " -"functionality as a :class:`dict`; keys and their corresponding values can be " -"stored, retrieved, and deleted, and the :keyword:`in` operator and " -"the :meth:`!keys` method are available, as well as :meth:`!get` and :meth:`!" -"setdefault` methods." +"The object returned by :func:`~dbm.open` supports the basic functionality of " +"mutable :term:`mappings `; keys and their corresponding values can " +"be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator " +"and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!" +"clear` are available. The :meth:`!keys` method returns a list instead of a " +"view object. The :meth:`!setdefault` method requires two arguments." msgstr "" -#: ../../library/dbm.rst:92 +#: ../../library/dbm.rst:95 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:96 +#: ../../library/dbm.rst:99 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:99 +#: ../../library/dbm.rst:102 msgid "" -":meth:`!get` and :meth:`!setdefault` methods are now available for " -"all :mod:`dbm` backends." +":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" +"`dbm` backends." msgstr "" -#: ../../library/dbm.rst:103 +#: ../../library/dbm.rst:106 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:107 +#: ../../library/dbm.rst:110 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:111 +#: ../../library/dbm.rst:114 +msgid ":meth:`!clear` methods are now available for all :mod:`dbm` backends." +msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" + +#: ../../library/dbm.rst:118 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:114 +#: ../../library/dbm.rst:121 msgid "" "import dbm\n" "\n" @@ -223,32 +228,32 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:141 +#: ../../library/dbm.rst:148 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:142 +#: ../../library/dbm.rst:149 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:145 +#: ../../library/dbm.rst:152 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:148 +#: ../../library/dbm.rst:155 msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" msgstr ":mod:`dbm.sqlite3` --- dbm 的 SQLite 後端" -#: ../../library/dbm.rst:156 +#: ../../library/dbm.rst:163 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/sqlite3.py`" -#: ../../library/dbm.rst:160 +#: ../../library/dbm.rst:167 msgid "" "This module uses the standard library :mod:`sqlite3` module to provide an " -"SQLite backend for the :mod:`dbm` module. The files created " -"by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other " -"SQLite browser, including the SQLite CLI." +"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." +"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " +"including the SQLite CLI." msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 @@ -263,39 +268,52 @@ msgstr "" "此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" "availability`。" -#: ../../library/dbm.rst:169 -msgid "" -"Open an SQLite database. The returned object behaves like a :term:`mapping`, " -"implements a :meth:`!close` method, and supports a \"closing\" context " -"manager via the :keyword:`with` keyword." -msgstr "" +#: ../../library/dbm.rst:176 +msgid "Open an SQLite database." +msgstr "打開一個 SQLite 資料庫。" -#: ../../library/dbm.rst:174 +#: ../../library/dbm.rst:178 msgid "The path to the database to be opened." msgstr "要打開的資料庫路徑" -#: ../../library/dbm.rst:185 +#: ../../library/dbm.rst:189 msgid "" "The Unix file access mode of the file (default: octal ``0o666``), used only " "when the database has to be created." msgstr "" -#: ../../library/dbm.rst:191 +#: ../../library/dbm.rst:193 +msgid "" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` " +"method requires two arguments. It also supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" + +#: ../../library/dbm.rst:198 ../../library/dbm.rst:399 +msgid "The following method is also provided:" +msgstr "也提供了以下方法:" + +#: ../../library/dbm.rst:202 +msgid "Close the SQLite database." +msgstr "關閉 SQLite 資料庫。" + +#: ../../library/dbm.rst:206 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr ":mod:`dbm.gnu` --- GNU 資料庫管理器" -#: ../../library/dbm.rst:197 +#: ../../library/dbm.rst:212 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:201 +#: ../../library/dbm.rst:216 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:207 ../../library/dbm.rst:321 +#: ../../library/dbm.rst:222 ../../library/dbm.rst:342 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." @@ -309,18 +327,24 @@ msgstr "" "此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" "台 `\\ 上不支援。" -#: ../../library/dbm.rst:214 +#: ../../library/dbm.rst:229 +msgid "" +"Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." +msgstr "" + +#: ../../library/dbm.rst:235 msgid "" -"Raised on :mod:`dbm.gnu`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like specifying " -"an incorrect key." +"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " +"supports." msgstr "" -#: ../../library/dbm.rst:220 +#: ../../library/dbm.rst:240 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "打開一個 GDBM 資料庫,並回傳一個 :class:`!gdbm` 物件。" -#: ../../library/dbm.rst:226 +#: ../../library/dbm.rst:246 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -332,29 +356,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:232 +#: ../../library/dbm.rst:252 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:235 +#: ../../library/dbm.rst:255 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:237 +#: ../../library/dbm.rst:257 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:239 +#: ../../library/dbm.rst:259 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:241 +#: ../../library/dbm.rst:261 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -364,24 +388,36 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:247 +#: ../../library/dbm.rst:267 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:255 +#: ../../library/dbm.rst:273 msgid "" -"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " -"supports." +":class:`!gdbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:257 -msgid "" -":class:`!gdbm` objects behave similar to :term:`mappings `, " -"but :meth:`!items` and :meth:`!values` methods are not supported. The " -"following methods are also provided:" -msgstr "" +#: ../../library/dbm.rst:280 ../../library/dbm.rst:393 +msgid "Added the :meth:`!get` and :meth:`!setdefault` methods." +msgstr "新增了 :meth:`!get` 和 :meth:`!setdefault` 方法。" + +#: ../../library/dbm.rst:283 ../../library/dbm.rst:396 +msgid "Added the :meth:`!clear` method." +msgstr "新增了 :meth:`!clear` 方法。" + +#: ../../library/dbm.rst:286 ../../library/dbm.rst:479 +msgid "The following methods are also provided:" +msgstr "也提供了以下方法:" + +#: ../../library/dbm.rst:290 +msgid "Close the GDBM database." +msgstr "關閉 GDBM 資料庫。" -#: ../../library/dbm.rst:263 +#: ../../library/dbm.rst:294 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -389,14 +425,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:270 +#: ../../library/dbm.rst:301 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:274 +#: ../../library/dbm.rst:305 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -408,45 +444,37 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:281 +#: ../../library/dbm.rst:312 msgid "" "If you have carried out a lot of deletions and would like to shrink the " -"space used by the GDBM file, this routine will reorganize the " -"database. :class:`!gdbm` objects will not shorten the length of a database " -"file except by using this reorganization; otherwise, deleted file space will " -"be kept and reused as new (key, value) pairs are added." +"space used by the GDBM file, this routine will reorganize the database. :" +"class:`!gdbm` objects will not shorten the length of a database file except " +"by using this reorganization; otherwise, deleted file space will be kept and " +"reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:289 +#: ../../library/dbm.rst:320 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:294 -msgid "Close the GDBM database." -msgstr "關閉 GDBM 資料庫。" - -#: ../../library/dbm.rst:298 -msgid "Remove all items from the GDBM database." -msgstr "移除 GDBM 資料庫的所有項目。" - -#: ../../library/dbm.rst:304 +#: ../../library/dbm.rst:325 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:310 +#: ../../library/dbm.rst:331 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:314 +#: ../../library/dbm.rst:335 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:326 +#: ../../library/dbm.rst:347 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -454,109 +482,104 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:335 +#: ../../library/dbm.rst:356 msgid "" -"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like specifying " -"an incorrect key." +"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." msgstr "" -#: ../../library/dbm.rst:341 +#: ../../library/dbm.rst:362 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:346 +#: ../../library/dbm.rst:367 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:348 +#: ../../library/dbm.rst:369 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:362 -msgid "" -":class:`!ndbm` objects behave similar to :term:`mappings `, " -"but :meth:`!items` and :meth:`!values` methods are not supported. The " -"following methods are also provided:" +#: ../../library/dbm.rst:383 +msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:366 -msgid "Accepts :term:`path-like object` for filename." +#: ../../library/dbm.rst:386 +msgid "" +":class:`!ndbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:371 +#: ../../library/dbm.rst:403 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:375 -msgid "Remove all items from the NDBM database." -msgstr "移除 NDBM 資料庫的所有項目。" - -#: ../../library/dbm.rst:381 +#: ../../library/dbm.rst:407 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:386 +#: ../../library/dbm.rst:412 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:392 +#: ../../library/dbm.rst:418 msgid "" -"The :mod:`dbm.dumb` module is intended as a last resort fallback for " -"the :mod:`dbm` module when a more robust module is not available. " -"The :mod:`dbm.dumb` module is not written for speed and is not nearly as " -"heavily used as the other database modules." +"The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" +"mod:`dbm` module when a more robust module is not available. The :mod:`dbm." +"dumb` module is not written for speed and is not nearly as heavily used as " +"the other database modules." msgstr "" -#: ../../library/dbm.rst:399 +#: ../../library/dbm.rst:425 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:404 +#: ../../library/dbm.rst:430 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:408 +#: ../../library/dbm.rst:434 msgid "" -"Raised on :mod:`dbm.dumb`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like " -"specifying an incorrect key." +"Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." msgstr "" -#: ../../library/dbm.rst:414 -msgid "" -"Open a :mod:`!dbm.dumb` database. The returned database object behaves " -"similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " -"and :meth:`~dumbdbm.close` methods." -msgstr "" +#: ../../library/dbm.rst:440 +msgid "Open a :mod:`!dbm.dumb` database." +msgstr "開啟一個 :mod:`!dbm.dumb` 資料庫。" -#: ../../library/dbm.rst:419 +#: ../../library/dbm.rst:442 msgid "" "The basename of the database file (without extensions). A new database " -"creates the following files: - :file:`{filename}.dat` " -"- :file:`{filename}.dir`" +"creates the following files: - :file:`{filename}.dat` - :file:`{filename}." +"dir`" msgstr "" -#: ../../library/dbm.rst:420 +#: ../../library/dbm.rst:443 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:423 +#: ../../library/dbm.rst:446 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:424 +#: ../../library/dbm.rst:447 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:427 +#: ../../library/dbm.rst:450 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -564,62 +587,50 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:428 +#: ../../library/dbm.rst:451 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:430 +#: ../../library/dbm.rst:453 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:437 +#: ../../library/dbm.rst:460 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:441 +#: ../../library/dbm.rst:464 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:444 +#: ../../library/dbm.rst:467 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:451 +#: ../../library/dbm.rst:474 msgid "" -"In addition to the methods provided by " -"the :class:`collections.abc.MutableMapping` class, the following methods are " -"provided:" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` and :meth:`!items` methods return lists, and the :meth:" +"`!setdefault` method requires two arguments. It also supports a \"closing\" " +"context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:457 +#: ../../library/dbm.rst:483 +msgid "Close the database." +msgstr "關閉資料庫。" + +#: ../../library/dbm.rst:487 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`shelve.Shelf.sync` method." msgstr "" -#: ../../library/dbm.rst:462 -msgid "Close the database." -msgstr "關閉資料庫。" - -#: ../../library/dbm.rst:388 +#: ../../library/dbm.rst:414 msgid "databases" msgstr "databases(資料庫)" - -#~ msgid "" -#~ ":meth:`!clear` methods are now available for all :mod:`dbm` backends." -#~ msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" - -#~ msgid "Open an SQLite database." -#~ msgstr "打開一個 SQLite 資料庫。" - -#~ msgid "The following method is also provided:" -#~ msgstr "也提供了以下方法:" - -#~ msgid "Close the SQLite database." -#~ msgstr "關閉 SQLite 資料庫。" diff --git a/library/decimal.po b/library/decimal.po index 83b16cccf9..73debdf317 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -1294,7 +1294,7 @@ msgstr "" #: ../../library/decimal.rst:946 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../library/decimal.rst:948 msgid "" @@ -2008,11 +2008,11 @@ msgstr "``-1999999999999999997``" #: ../../library/decimal.rst:1586 msgid "``256``" -msgstr "" +msgstr "``256``" #: ../../library/decimal.rst:1586 msgid "``512``" -msgstr "" +msgstr "``512``" #: ../../library/decimal.rst:1591 msgid "" @@ -2322,6 +2322,18 @@ msgid "" ">>> u * (v+w)\n" "Decimal('0.0060000')" msgstr "" +">>> getcontext().prec = 20\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.51111111')\n" +">>> u + (v + w)\n" +"Decimal('9.51111111')\n" +">>>\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.0060000')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" #: ../../library/decimal.rst:1839 msgid "Special values" diff --git a/library/dialog.po b/library/dialog.po index 9e4abefdb9..cdacc53c2a 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -59,7 +59,7 @@ msgstr "" #: ../../library/dialog.rst:43 msgid ":mod:`tkinter.filedialog` --- File selection dialogs" -msgstr "" +msgstr ":mod:`tkinter.filedialog` --- 檔案選擇對話框" #: ../../library/dialog.rst:49 msgid "**Source code:** :source:`Lib/tkinter/filedialog.py`" diff --git a/library/difflib.po b/library/difflib.po index 3296ad6fc8..8db7c3d59a 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-08 00:17+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,7 +89,7 @@ msgstr "" #: ../../library/difflib.rst:69 msgid "Code" -msgstr "" +msgstr "程式碼" #: ../../library/difflib.rst:69 ../../library/difflib.rst:496 msgid "Meaning" @@ -310,7 +310,7 @@ msgid "" "*linejunk*: A function that accepts a single string argument, and returns " "true if the string is junk, or false if not. The default is ``None``. There " "is also a module-level function :func:`IS_LINE_JUNK`, which filters out " -"lines without visible characters, except for at most one pound character " +"lines without visible characters, except for at most one hash character " "(``'#'``) -- however the underlying :class:`SequenceMatcher` class does a " "dynamic analysis of which lines are so frequent as to constitute noise, and " "this usually works better than using this function." diff --git a/library/dis.po b/library/dis.po index a786deae55..0f0a086366 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-30 00:13+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-" @@ -61,17 +61,17 @@ msgstr "" msgid "" "Some instructions are accompanied by one or more inline cache entries, which " "take the form of :opcode:`CACHE` instructions. These instructions are hidden " -"by default, but can be shown by passing ``show_caches=True`` to " -"any :mod:`dis` utility. Furthermore, the interpreter now adapts the bytecode " -"to specialize it for different runtime conditions. The adaptive bytecode can " -"be shown by passing ``adaptive=True``." +"by default, but can be shown by passing ``show_caches=True`` to any :mod:" +"`dis` utility. Furthermore, the interpreter now adapts the bytecode to " +"specialize it for different runtime conditions. The adaptive bytecode can be " +"shown by passing ``adaptive=True``." msgstr "" #: ../../library/dis.rst:45 msgid "" "The argument of a jump is the offset of the target instruction relative to " -"the instruction that appears immediately after the jump " -"instruction's :opcode:`CACHE` entries." +"the instruction that appears immediately after the jump instruction's :" +"opcode:`CACHE` entries." msgstr "" #: ../../library/dis.rst:50 @@ -187,9 +187,9 @@ msgstr "" #: ../../library/dis.rst:136 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." +"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:144 @@ -261,8 +261,8 @@ msgstr "" #: ../../library/dis.rst:188 msgid "" -"Return a formatted view of the bytecode operations (the same as printed " -"by :func:`dis.dis`, but returned as a multi-line string)." +"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:193 @@ -487,10 +487,10 @@ msgstr "" #: ../../library/dis.rst:393 msgid "" -"This generator function uses the :meth:`~codeobject.co_lines` method of " -"the :ref:`code object ` *code* to find the offsets which are " -"starts of lines in the source code. They are generated as ``(offset, " -"lineno)`` pairs." +"This generator function uses the :meth:`~codeobject.co_lines` method of the :" +"ref:`code object ` *code* to find the offsets which are starts " +"of lines in the source code. They are generated as ``(offset, lineno)`` " +"pairs." msgstr "" #: ../../library/dis.rst:398 @@ -499,8 +499,8 @@ msgstr "" #: ../../library/dis.rst:401 msgid "" -"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " -"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"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 "" @@ -687,30 +687,41 @@ msgid "" msgstr "" #: ../../library/dis.rst:590 +msgid "" +"Do nothing code. Used by the interpreter to record :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events for :mod:`sys." +"monitoring`." +msgstr "" + +#: ../../library/dis.rst:599 +msgid "Removes the iterator from the top of the stack." +msgstr "" + +#: ../../library/dis.rst:606 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:592 +#: ../../library/dis.rst:608 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:597 +#: ../../library/dis.rst:613 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:606 +#: ../../library/dis.rst:622 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:614 +#: ../../library/dis.rst:630 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:617 +#: ../../library/dis.rst:633 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -718,15 +729,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:625 +#: ../../library/dis.rst:641 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:627 +#: ../../library/dis.rst:643 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:650 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 " @@ -734,86 +745,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:639 +#: ../../library/dis.rst:655 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:643 +#: ../../library/dis.rst:659 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:650 +#: ../../library/dis.rst:666 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:652 +#: ../../library/dis.rst:668 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:658 +#: ../../library/dis.rst:674 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "實作 ``STACK[-1] = -STACK[-1]``。" -#: ../../library/dis.rst:663 +#: ../../library/dis.rst:679 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "實作 ``STACK[-1] = not STACK[-1]``。" -#: ../../library/dis.rst:665 ../../library/dis.rst:1372 -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:681 ../../library/dis.rst:1383 +#: ../../library/dis.rst:1399 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:671 +#: ../../library/dis.rst:687 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "實作 ``STACK[-1] = ~STACK[-1]``。" -#: ../../library/dis.rst:676 +#: ../../library/dis.rst:692 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "實作 ``STACK[-1] = iter(STACK[-1])``。" -#: ../../library/dis.rst:681 +#: ../../library/dis.rst:697 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:689 +#: ../../library/dis.rst:705 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:694 +#: ../../library/dis.rst:710 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:712 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:699 +#: ../../library/dis.rst:715 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:706 +#: ../../library/dis.rst:722 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:709 +#: ../../library/dis.rst:725 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -823,22 +834,22 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:714 +#: ../../library/dis.rst:730 msgid "" "With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " "``BINARY_SUBSCR``)" msgstr "" -#: ../../library/dis.rst:720 ../../library/dis.rst:730 -#: ../../library/dis.rst:738 ../../library/dis.rst:750 -#: ../../library/dis.rst:828 ../../library/dis.rst:838 -#: ../../library/dis.rst:848 ../../library/dis.rst:1054 -#: ../../library/dis.rst:1065 ../../library/dis.rst:1215 -#: ../../library/dis.rst:1227 ../../library/dis.rst:1239 +#: ../../library/dis.rst:736 ../../library/dis.rst:746 +#: ../../library/dis.rst:754 ../../library/dis.rst:766 +#: ../../library/dis.rst:844 ../../library/dis.rst:854 +#: ../../library/dis.rst:864 ../../library/dis.rst:1070 +#: ../../library/dis.rst:1081 ../../library/dis.rst:1226 +#: ../../library/dis.rst:1238 ../../library/dis.rst:1250 msgid "Implements::" msgstr "實作了: ::" -#: ../../library/dis.rst:722 +#: ../../library/dis.rst:738 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -850,7 +861,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:732 +#: ../../library/dis.rst:748 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -860,7 +871,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:740 +#: ../../library/dis.rst:756 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -872,7 +883,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:752 +#: ../../library/dis.rst:768 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -886,11 +897,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:761 +#: ../../library/dis.rst:777 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:765 +#: ../../library/dis.rst:781 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -898,39 +909,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:770 +#: ../../library/dis.rst:786 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:773 +#: ../../library/dis.rst:789 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:774 +#: ../../library/dis.rst:790 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:778 +#: ../../library/dis.rst:794 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:784 +#: ../../library/dis.rst:800 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:787 +#: ../../library/dis.rst:803 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:810 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:802 +#: ../../library/dis.rst:818 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]`` " @@ -938,25 +949,25 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:809 ../../library/dis.rst:900 -#: ../../library/dis.rst:911 +#: ../../library/dis.rst:825 ../../library/dis.rst:916 +#: ../../library/dis.rst:927 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:815 +#: ../../library/dis.rst:831 msgid "" -"Handles an exception raised during a :meth:`~generator.throw` " -"or :meth:`~generator.close` call through the current frame. If " -"``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from " -"the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." +"Handles an exception raised during a :meth:`~generator.throw` or :meth:" +"`~generator.close` call through the current frame. If ``STACK[-1]`` is an " +"instance of :exc:`StopIteration`, pop three values from the stack and push " +"its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:840 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:830 +#: ../../library/dis.rst:846 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -964,11 +975,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:833 +#: ../../library/dis.rst:849 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:840 +#: ../../library/dis.rst:856 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -976,11 +987,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:843 +#: ../../library/dis.rst:859 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:850 +#: ../../library/dis.rst:866 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -990,49 +1001,49 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:854 +#: ../../library/dis.rst:870 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:857 +#: ../../library/dis.rst:873 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:861 +#: ../../library/dis.rst:877 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 off, the container object remains on the stack so that it is " -"available for further iterations of the loop." +"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 " +"off, the container object remains on the stack so that it is available for " +"further iterations of the loop." msgstr "" -#: ../../library/dis.rst:869 +#: ../../library/dis.rst:885 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:874 +#: ../../library/dis.rst:890 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:876 +#: ../../library/dis.rst:892 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:879 +#: ../../library/dis.rst:895 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:882 +#: ../../library/dis.rst:898 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:888 +#: ../../library/dis.rst:904 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 " @@ -1040,39 +1051,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:898 +#: ../../library/dis.rst:914 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:905 +#: ../../library/dis.rst:921 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." +"pops an additional value from the stack which is used to set :attr:`~frame." +"f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:916 +#: ../../library/dis.rst:932 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:924 +#: ../../library/dis.rst:940 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:932 +#: ../../library/dis.rst:948 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:935 +#: ../../library/dis.rst:951 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 " @@ -1080,7 +1091,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:944 +#: ../../library/dis.rst:960 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 " @@ -1088,32 +1099,32 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:951 +#: ../../library/dis.rst:967 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:958 +#: ../../library/dis.rst:974 msgid "" "Pushes a common constant onto the stack. The interpreter contains a " -"hardcoded list of constants supported by this instruction. Used by " -"the :keyword:`assert` statement to load :exc:`AssertionError`." +"hardcoded list of constants supported by this instruction. Used by the :" +"keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" -#: ../../library/dis.rst:967 +#: ../../library/dis.rst:983 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:972 +#: ../../library/dis.rst:988 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:980 +#: ../../library/dis.rst:996 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 " @@ -1121,7 +1132,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:990 +#: ../../library/dis.rst:1006 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, " @@ -1130,42 +1141,40 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:1000 +#: ../../library/dis.rst:1016 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``." +"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:1006 ../../library/dis.rst:1753 +#: ../../library/dis.rst:1022 ../../library/dis.rst:1764 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1013 +#: ../../library/dis.rst:1029 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` " -"or :opcode:`STORE_GLOBAL` if possible." +"objects>`. The compiler tries to use :opcode:`STORE_FAST` or :opcode:" +"`STORE_GLOBAL` if possible." msgstr "" -#: ../../library/dis.rst:1020 +#: ../../library/dis.rst:1036 msgid "" -"Implements ``del name``, where *namei* is the index " -"into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." +"Implements ``del name``, where *namei* is the index into :attr:`~codeobject." +"co_names` attribute of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1026 +#: ../../library/dis.rst:1042 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:1029 +#: ../../library/dis.rst:1045 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1173,7 +1182,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1035 +#: ../../library/dis.rst:1051 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1181,11 +1190,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1040 +#: ../../library/dis.rst:1056 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1042 +#: ../../library/dis.rst:1058 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 " @@ -1194,13 +1203,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1064 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:1056 +#: ../../library/dis.rst:1072 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1210,13 +1219,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1060 +#: ../../library/dis.rst:1076 msgid "" -"where *namei* is the index of name in :attr:`~codeobject.co_names` of " -"the :ref:`code object `." +"where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" +"ref:`code object `." msgstr "" -#: ../../library/dis.rst:1067 +#: ../../library/dis.rst:1083 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1224,48 +1233,43 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1070 +#: ../../library/dis.rst:1086 msgid "" -"where *namei* is the index of name into :attr:`~codeobject.co_names` of " -"the :ref:`code object `." +"where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" +"ref:`code object `." msgstr "" -#: ../../library/dis.rst:1076 +#: ../../library/dis.rst:1092 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1081 +#: ../../library/dis.rst:1097 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1086 +#: ../../library/dis.rst:1102 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1091 -msgid "" -"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." -msgstr "" - -#: ../../library/dis.rst:1096 +#: ../../library/dis.rst:1107 msgid "" "Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" msgstr "" -#: ../../library/dis.rst:1104 +#: ../../library/dis.rst:1115 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:1110 +#: ../../library/dis.rst:1121 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`." +"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" +"opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1130 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 " @@ -1274,14 +1278,14 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1130 +#: ../../library/dis.rst:1141 msgid "" "Constructs a new :class:`~string.templatelib.Template` instance from a tuple " "of strings and a tuple of interpolations and pushes the resulting object " "onto the stack::" msgstr "" -#: ../../library/dis.rst:1134 +#: ../../library/dis.rst:1145 msgid "" "interpolations = STACK.pop()\n" "strings = STACK.pop()\n" @@ -1291,33 +1295,33 @@ msgstr "" "strings = STACK.pop()\n" "STACK.append(_build_template(strings, interpolations))" -#: ../../library/dis.rst:1143 +#: ../../library/dis.rst:1154 msgid "" "Constructs a new :class:`~string.templatelib.Interpolation` instance from a " "value and its source expression and pushes the resulting object onto the " "stack." msgstr "" -#: ../../library/dis.rst:1147 +#: ../../library/dis.rst:1158 msgid "" "If no conversion or format specification is present, ``format`` is set to " "``2``." msgstr "" -#: ../../library/dis.rst:1150 +#: ../../library/dis.rst:1161 msgid "" "If the low bit of ``format`` is set, it indicates that the interpolation " "contains a format specification." msgstr "" -#: ../../library/dis.rst:1153 +#: ../../library/dis.rst:1164 msgid "" "If ``format >> 2`` is non-zero, it indicates that the interpolation contains " "a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " "no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" msgstr "" -#: ../../library/dis.rst:1158 +#: ../../library/dis.rst:1169 msgid "" "conversion = format >> 2\n" "if format & 1:\n" @@ -1339,13 +1343,13 @@ msgstr "" "STACK.append(_build_interpolation(value, expression, conversion, " "format_spec))" -#: ../../library/dis.rst:1172 +#: ../../library/dis.rst:1183 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1175 +#: ../../library/dis.rst:1186 msgid "" "if count == 0:\n" " value = ()\n" @@ -1363,34 +1367,34 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1197 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1191 +#: ../../library/dis.rst:1202 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1196 +#: ../../library/dis.rst:1207 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:1200 +#: ../../library/dis.rst:1211 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1207 +#: ../../library/dis.rst:1218 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1217 +#: ../../library/dis.rst:1228 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1398,11 +1402,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1220 +#: ../../library/dis.rst:1231 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1240 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1410,11 +1414,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1243 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1241 +#: ../../library/dis.rst:1252 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1422,21 +1426,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1255 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1251 +#: ../../library/dis.rst:1262 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1258 +#: ../../library/dis.rst:1269 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:1261 +#: ../../library/dis.rst:1272 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 " @@ -1448,140 +1452,140 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1270 +#: ../../library/dis.rst:1281 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:1277 +#: ../../library/dis.rst:1288 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:1281 +#: ../../library/dis.rst:1292 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1283 +#: ../../library/dis.rst:1294 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1284 +#: ../../library/dis.rst:1295 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1285 +#: ../../library/dis.rst:1296 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1287 +#: ../../library/dis.rst:1298 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:1290 +#: ../../library/dis.rst:1301 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." +"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:1294 +#: ../../library/dis.rst:1305 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:1302 +#: ../../library/dis.rst:1313 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:1306 +#: ../../library/dis.rst:1317 msgid "" -"The fifth-lowest bit of the oparg now indicates a forced conversion " -"to :class:`bool`." +"The fifth-lowest bit of the oparg now indicates a forced conversion to :" +"class:`bool`." msgstr "" -#: ../../library/dis.rst:1313 +#: ../../library/dis.rst:1324 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1320 +#: ../../library/dis.rst:1331 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1327 +#: ../../library/dis.rst:1338 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " -"popped and provide the *fromlist* and *level* arguments " -"of :func:`__import__`. The module object is pushed onto the stack. The " -"current namespace is not affected: for a proper import statement, a " -"subsequent :opcode:`STORE_FAST` instruction modifies the namespace." +"popped and provide the *fromlist* and *level* arguments of :func:" +"`__import__`. The module object is pushed onto the stack. The current " +"namespace is not affected: for a proper import statement, a subsequent :" +"opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1346 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:1342 +#: ../../library/dis.rst:1353 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1347 +#: ../../library/dis.rst:1358 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1354 +#: ../../library/dis.rst:1365 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1361 +#: ../../library/dis.rst:1372 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1364 ../../library/dis.rst:1380 +#: ../../library/dis.rst:1375 ../../library/dis.rst:1391 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:1369 ../../library/dis.rst:1385 -#: ../../library/dis.rst:1398 ../../library/dis.rst:1409 +#: ../../library/dis.rst:1380 ../../library/dis.rst:1396 +#: ../../library/dis.rst:1409 ../../library/dis.rst:1420 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1377 +#: ../../library/dis.rst:1388 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1393 +#: ../../library/dis.rst:1404 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1404 +#: ../../library/dis.rst:1415 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1425 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 " @@ -1589,219 +1593,219 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1419 +#: ../../library/dis.rst:1430 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1424 +#: ../../library/dis.rst:1435 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1426 +#: ../../library/dis.rst:1437 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:1432 +#: ../../library/dis.rst:1443 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1434 +#: ../../library/dis.rst:1445 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:1440 +#: ../../library/dis.rst:1451 msgid "" "Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1447 +#: ../../library/dis.rst:1458 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1455 +#: ../../library/dis.rst:1466 msgid "" "Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1462 +#: ../../library/dis.rst:1473 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:1470 +#: ../../library/dis.rst:1481 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:1478 +#: ../../library/dis.rst:1489 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1482 +#: ../../library/dis.rst:1493 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1489 +#: ../../library/dis.rst:1500 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:1497 +#: ../../library/dis.rst:1508 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1502 +#: ../../library/dis.rst:1513 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:1510 +#: ../../library/dis.rst:1521 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:1513 ../../library/dis.rst:1535 -#: ../../library/dis.rst:1546 +#: ../../library/dis.rst:1524 ../../library/dis.rst:1546 +#: ../../library/dis.rst:1557 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1519 +#: ../../library/dis.rst:1530 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 " -"found there, loads it from the cell contained in slot ``i``, similar " -"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"found there, loads it from the cell contained in slot ``i``, similar to :" +"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " "` in class bodies (which previously used :opcode:`!" "LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " "class bodies." msgstr "" -#: ../../library/dis.rst:1532 +#: ../../library/dis.rst:1543 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1541 +#: ../../library/dis.rst:1552 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1552 +#: ../../library/dis.rst:1563 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:1561 +#: ../../library/dis.rst:1572 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1564 +#: ../../library/dis.rst:1575 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1565 +#: ../../library/dis.rst:1576 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1566 +#: ../../library/dis.rst:1577 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:1572 +#: ../../library/dis.rst:1583 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1575 ../../library/dis.rst:1599 +#: ../../library/dis.rst:1586 ../../library/dis.rst:1610 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1576 ../../library/dis.rst:1600 +#: ../../library/dis.rst:1587 ../../library/dis.rst:1611 msgid "``self`` or ``NULL``" msgstr "``self`` 或 ``NULL``" -#: ../../library/dis.rst:1577 ../../library/dis.rst:1601 +#: ../../library/dis.rst:1588 ../../library/dis.rst:1612 msgid "The remaining positional arguments" msgstr "剩餘的位置引數" -#: ../../library/dis.rst:1579 +#: ../../library/dis.rst:1590 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1581 +#: ../../library/dis.rst:1592 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:1587 +#: ../../library/dis.rst:1598 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1590 +#: ../../library/dis.rst:1601 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1607 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:1602 +#: ../../library/dis.rst:1613 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1614 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1605 +#: ../../library/dis.rst:1616 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:1608 +#: ../../library/dis.rst:1619 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:1617 +#: ../../library/dis.rst:1628 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 " @@ -1813,33 +1817,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1643 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." +"``NULL`` pushed by :opcode:`!LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1641 +#: ../../library/dis.rst:1652 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1643 +#: ../../library/dis.rst:1654 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1646 +#: ../../library/dis.rst:1657 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1649 +#: ../../library/dis.rst:1660 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1656 +#: ../../library/dis.rst:1667 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 " @@ -1847,42 +1851,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1660 +#: ../../library/dis.rst:1671 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1662 +#: ../../library/dis.rst:1673 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1663 +#: ../../library/dis.rst:1674 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1664 +#: ../../library/dis.rst:1675 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1673 +#: ../../library/dis.rst:1684 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1675 +#: ../../library/dis.rst:1686 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1690 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1692 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1894,11 +1898,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1686 +#: ../../library/dis.rst:1697 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1691 +#: ../../library/dis.rst:1702 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 " @@ -1906,11 +1910,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1699 +#: ../../library/dis.rst:1710 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1701 +#: ../../library/dis.rst:1712 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1920,28 +1924,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1705 +#: ../../library/dis.rst:1716 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1706 +#: ../../library/dis.rst:1717 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1707 +#: ../../library/dis.rst:1718 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1709 ../../library/dis.rst:1722 -#: ../../library/dis.rst:1735 +#: ../../library/dis.rst:1720 ../../library/dis.rst:1733 +#: ../../library/dis.rst:1746 msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1716 +#: ../../library/dis.rst:1727 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1718 +#: ../../library/dis.rst:1729 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1951,11 +1955,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1728 +#: ../../library/dis.rst:1739 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1730 +#: ../../library/dis.rst:1741 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1967,14 +1971,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1742 +#: ../../library/dis.rst:1753 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:1746 +#: ../../library/dis.rst:1757 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 " @@ -1982,219 +1986,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1760 +#: ../../library/dis.rst:1771 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1762 +#: ../../library/dis.rst:1773 msgid "" "The ``context`` operand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1776 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1767 +#: ../../library/dis.rst:1778 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1779 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1769 +#: ../../library/dis.rst:1780 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1782 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1776 +#: ../../library/dis.rst:1787 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1793 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:1791 +#: ../../library/dis.rst:1802 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1794 +#: ../../library/dis.rst:1805 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:1803 +#: ../../library/dis.rst:1814 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:1807 +#: ../../library/dis.rst:1818 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1810 +#: ../../library/dis.rst:1821 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:1814 +#: ../../library/dis.rst:1825 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:1819 +#: ../../library/dis.rst:1830 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1824 +#: ../../library/dis.rst:1835 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:1828 ../../library/dis.rst:1882 +#: ../../library/dis.rst:1839 ../../library/dis.rst:1893 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 +#: ../../library/dis.rst:1842 ../../library/dis.rst:1896 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 +#: ../../library/dis.rst:1842 ../../library/dis.rst:1896 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1844 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1833 ../../library/dis.rst:1887 +#: ../../library/dis.rst:1844 ../../library/dis.rst:1898 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1835 +#: ../../library/dis.rst:1846 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1835 +#: ../../library/dis.rst:1846 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1838 +#: ../../library/dis.rst:1849 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1838 +#: ../../library/dis.rst:1849 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1852 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1852 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1855 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1855 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1857 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1857 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1849 +#: ../../library/dis.rst:1860 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1849 +#: ../../library/dis.rst:1860 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1862 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1862 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1864 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1864 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1856 +#: ../../library/dis.rst:1867 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1856 +#: ../../library/dis.rst:1867 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1870 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1870 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1862 +#: ../../library/dis.rst:1873 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1862 +#: ../../library/dis.rst:1873 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:1874 +#: ../../library/dis.rst:1885 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1877 +#: ../../library/dis.rst:1888 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2206,69 +2210,69 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1887 +#: ../../library/dis.rst:1898 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1889 +#: ../../library/dis.rst:1900 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1889 +#: ../../library/dis.rst:1900 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1893 +#: ../../library/dis.rst:1904 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1893 +#: ../../library/dis.rst:1904 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1907 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1907 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1900 +#: ../../library/dis.rst:1911 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1900 +#: ../../library/dis.rst:1911 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1909 +#: ../../library/dis.rst:1920 msgid "" -"Performs special method lookup on ``STACK[-1]``. If " -"``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; " -"STACK[-1]`` on the stack. If ``type(STACK[-1]).__xxx__`` is not a method, " -"leave ``STACK[-1].__xxx__; NULL`` on the stack." +"Performs special method lookup on ``STACK[-1]``. If ``type(STACK[-1])." +"__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; STACK[-1]`` on the " +"stack. If ``type(STACK[-1]).__xxx__`` is not a method, leave ``STACK[-1]." +"__xxx__; NULL`` on the stack." msgstr "" -#: ../../library/dis.rst:1918 +#: ../../library/dis.rst:1929 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1931 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:1925 +#: ../../library/dis.rst:1936 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:1932 +#: ../../library/dis.rst:1943 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 " @@ -2277,98 +2281,96 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1941 +#: ../../library/dis.rst:1952 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:1945 +#: ../../library/dis.rst:1956 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." +"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:1952 +#: ../../library/dis.rst:1963 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1958 +#: ../../library/dis.rst:1969 +msgid "" +"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." +msgstr "" + +#: ../../library/dis.rst:1975 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1964 +#: ../../library/dis.rst:1981 msgid "" "Conditional jumps which do not impact the stack. Replaced by the sequence " "``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" -#: ../../library/dis.rst:1969 +#: ../../library/dis.rst:1986 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1972 +#: ../../library/dis.rst:1989 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1974 +#: ../../library/dis.rst:1991 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1980 -msgid "" -"Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " -"flag set in the arg." -msgstr "" - -#: ../../library/dis.rst:1987 +#: ../../library/dis.rst:1998 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1989 +#: ../../library/dis.rst:2000 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1992 +#: ../../library/dis.rst:2003 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:1999 +#: ../../library/dis.rst:2010 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:2004 +#: ../../library/dis.rst:2015 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:2009 +#: ../../library/dis.rst:2020 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:2014 +#: ../../library/dis.rst:2025 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:2021 +#: ../../library/dis.rst:2032 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:2026 +#: ../../library/dis.rst:2037 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2377,58 +2379,46 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:2034 +#: ../../library/dis.rst:2045 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:2039 +#: ../../library/dis.rst:2050 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:2046 +#: ../../library/dis.rst:2057 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:2051 +#: ../../library/dis.rst:2062 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:2055 +#: ../../library/dis.rst:2066 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:2062 +#: ../../library/dis.rst:2073 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:2064 +#: ../../library/dis.rst:2075 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:2070 +#: ../../library/dis.rst:2081 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:2072 +#: ../../library/dis.rst:2083 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1671 +#: ../../library/dis.rst:1682 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1671 +#: ../../library/dis.rst:1682 msgid "slice" msgstr "slice(切片)" - -#~ msgid "" -#~ "key = STACK.pop()\n" -#~ "container = STACK.pop()\n" -#~ "STACK.append(container[key])" -#~ msgstr "" -#~ "key = STACK.pop()\n" -#~ "container = STACK.pop()\n" -#~ "STACK.append(container[key])" - -#~ msgid "STACK.extend((__aexit__, __aenter__())" -#~ msgstr "STACK.extend((__aexit__, __aenter__())" diff --git a/library/doctest.po b/library/doctest.po index 11f8553e6d..4b4508a442 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -1315,6 +1315,12 @@ msgid "" ">>> print(f'{1000**0.1:.4f}') # much safer\n" "1.9953" msgstr "" +">>> 1000**0.1 # 有風險\n" +"1.9952623149688797\n" +">>> round(1000**0.1, 9) # 更安全\n" +"1.995262315\n" +">>> print(f'{1000**0.1:.4f}') # 更加安全\n" +"1.9953" #: ../../library/doctest.rst:887 msgid "" @@ -1327,6 +1333,8 @@ msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" +">>> 3./4 # utterly safe\n" +"0.75" #: ../../library/doctest.rst:893 msgid "" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index f7a5f59460..98b599220d 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -704,7 +704,7 @@ msgstr "" #: ../../library/email.compat32-message.rst:554 msgid "``replace`` keyword was added." -msgstr "" +msgstr "新增 ``replace`` 關鍵字。" #: ../../library/email.compat32-message.rst:559 msgid "" diff --git a/library/email.message.po b/library/email.message.po index 3c38c5cd97..776855ae1d 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -483,7 +483,7 @@ msgstr "" #: ../../library/email.message.rst:384 msgid "``replace`` keyword was added." -msgstr "" +msgstr "新增 ``replace`` 關鍵字。" #: ../../library/email.message.rst:389 msgid "" diff --git a/library/enum.po b/library/enum.po index 23d76be011..5262e18ad2 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-03 00:13+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -647,6 +647,7 @@ msgstr "" #: ../../library/enum.rst:318 msgid "" +">>> from enum import Enum\n" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -664,6 +665,7 @@ msgid "" "['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', " "'today', 'value']" msgstr "" +">>> from enum import Enum\n" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -685,11 +687,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:336 +#: ../../library/enum.rst:337 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:337 +#: ../../library/enum.rst:338 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -697,7 +699,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:338 +#: ../../library/enum.rst:339 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -705,19 +707,19 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:339 +#: ../../library/enum.rst:340 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:341 +#: ../../library/enum.rst:342 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:344 +#: ../../library/enum.rst:345 msgid "" -">>> from enum import auto\n" +">>> from enum import auto, Enum\n" ">>> class PowersOfThree(Enum):\n" "... @staticmethod\n" "... def _generate_next_value_(name, start, count, last_values):\n" @@ -728,7 +730,7 @@ msgid "" ">>> PowersOfThree.SECOND.value\n" "9" msgstr "" -">>> from enum import auto\n" +">>> from enum import auto, Enum\n" ">>> class PowersOfThree(Enum):\n" "... @staticmethod\n" "... def _generate_next_value_(name, start, count, last_values):\n" @@ -739,7 +741,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:357 +#: ../../library/enum.rst:358 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -747,19 +749,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:364 +#: ../../library/enum.rst:365 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:368 +#: ../../library/enum.rst:369 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:373 +#: ../../library/enum.rst:374 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -767,9 +769,9 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:376 +#: ../../library/enum.rst:377 msgid "" -">>> from enum import StrEnum\n" +">>> from enum import auto, StrEnum\n" ">>> class Build(StrEnum):\n" "... DEBUG = auto()\n" "... OPTIMIZED = auto()\n" @@ -786,7 +788,7 @@ msgid "" ">>> Build('deBUG')\n" "" msgstr "" -">>> from enum import StrEnum\n" +">>> from enum import auto, StrEnum\n" ">>> class Build(StrEnum):\n" "... DEBUG = auto()\n" "... OPTIMIZED = auto()\n" @@ -803,7 +805,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:395 +#: ../../library/enum.rst:396 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -812,12 +814,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:403 +#: ../../library/enum.rst:404 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:407 +#: ../../library/enum.rst:408 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -825,7 +827,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:412 +#: ../../library/enum.rst:413 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -833,8 +835,9 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:415 +#: ../../library/enum.rst:416 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -847,6 +850,7 @@ msgid "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -859,7 +863,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:428 +#: ../../library/enum.rst:430 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -867,8 +871,9 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:431 +#: ../../library/enum.rst:433 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -880,6 +885,7 @@ msgid "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -891,7 +897,7 @@ msgstr "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:443 +#: ../../library/enum.rst:446 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -899,8 +905,9 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:446 +#: ../../library/enum.rst:449 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -912,6 +919,7 @@ msgid "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -923,21 +931,21 @@ msgstr "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:458 +#: ../../library/enum.rst:462 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:461 +#: ../../library/enum.rst:465 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:465 +#: ../../library/enum.rst:469 msgid "Adds a new name as an alias to an existing member::" msgstr "新增一個名稱作為現有成員的別名: ::" -#: ../../library/enum.rst:467 +#: ../../library/enum.rst:471 msgid "" ">>> Color.RED._add_alias_(\"ERROR\")\n" ">>> Color.ERROR\n" @@ -947,17 +955,17 @@ msgstr "" ">>> Color.ERROR\n" "" -#: ../../library/enum.rst:471 +#: ../../library/enum.rst:475 msgid "" "Raises a :exc:`NameError` if the name is already assigned to a different " "member." msgstr "如果該名稱已經被指派給不同的成員,則會引發 :exc:`NameError`。" -#: ../../library/enum.rst:477 +#: ../../library/enum.rst:481 msgid "Adds a new value as an alias to an existing member::" msgstr "新增一個值作為現有成員的別名: ::" -#: ../../library/enum.rst:479 +#: ../../library/enum.rst:483 msgid "" ">>> Color.RED._add_value_alias_(42)\n" ">>> Color(42)\n" @@ -967,13 +975,13 @@ msgstr "" ">>> Color(42)\n" "" -#: ../../library/enum.rst:483 +#: ../../library/enum.rst:487 msgid "" "Raises a :exc:`ValueError` if the value is already linked with a different " "member." msgstr "如果該值已經被連結到不同的成員,則會引發 :exc:`ValueError`。" -#: ../../library/enum.rst:490 +#: ../../library/enum.rst:494 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " @@ -983,13 +991,13 @@ msgstr "" "*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" "的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:511 +#: ../../library/enum.rst:515 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:514 +#: ../../library/enum.rst:518 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -999,7 +1007,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:521 +#: ../../library/enum.rst:525 msgid "" "*StrEnum* is the same as :class:`Enum`, but its members are also strings and " "can be used in most of the same places that a string can be used. The result " @@ -1009,7 +1017,7 @@ msgstr "" "*StrEnum* 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使用" "字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:542 +#: ../../library/enum.rst:546 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -1020,13 +1028,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(MyStrEnum.MY_MEMBER)``。" -#: ../../library/enum.rst:549 +#: ../../library/enum.rst:553 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:554 +#: ../../library/enum.rst:558 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -1036,7 +1044,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:562 +#: ../../library/enum.rst:566 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -1046,11 +1054,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:568 +#: ../../library/enum.rst:572 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:570 +#: ../../library/enum.rst:574 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1086,11 +1094,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:589 +#: ../../library/enum.rst:593 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:591 +#: ../../library/enum.rst:595 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1102,11 +1110,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:600 +#: ../../library/enum.rst:604 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:602 +#: ../../library/enum.rst:606 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1118,11 +1126,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:611 +#: ../../library/enum.rst:615 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:613 +#: ../../library/enum.rst:617 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1140,11 +1148,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:623 +#: ../../library/enum.rst:627 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:629 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1152,11 +1160,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:630 +#: ../../library/enum.rst:634 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:632 +#: ../../library/enum.rst:636 msgid "" ">>> purple & white\n" "\n" @@ -1168,11 +1176,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:639 +#: ../../library/enum.rst:643 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:641 +#: ../../library/enum.rst:645 msgid "" ">>> purple ^ white\n" "\n" @@ -1184,11 +1192,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:648 +#: ../../library/enum.rst:652 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:650 +#: ../../library/enum.rst:654 msgid "" ">>> ~white\n" "\n" @@ -1204,7 +1212,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:659 +#: ../../library/enum.rst:663 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1212,17 +1220,17 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:664 +#: ../../library/enum.rst:668 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:667 +#: ../../library/enum.rst:671 msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是:" -#: ../../library/enum.rst:675 +#: ../../library/enum.rst:679 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." @@ -1230,13 +1238,13 @@ msgstr "" "``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" "數的地方。" -#: ../../library/enum.rst:689 +#: ../../library/enum.rst:693 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:692 +#: ../../library/enum.rst:696 msgid "" ">>> Color.RED + 2\n" "3" @@ -1244,25 +1252,25 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:695 +#: ../../library/enum.rst:699 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:697 +#: ../../library/enum.rst:701 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:702 msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:700 +#: ../../library/enum.rst:704 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是: ::" -#: ../../library/enum.rst:702 +#: ../../library/enum.rst:706 msgid "" ">>> Color(0)\n" "" @@ -1270,14 +1278,14 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../library/enum.rst:707 +#: ../../library/enum.rst:711 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:712 +#: ../../library/enum.rst:716 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1287,7 +1295,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:716 +#: ../../library/enum.rst:720 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1296,7 +1304,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:722 +#: ../../library/enum.rst:726 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1304,15 +1312,15 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料型別的 :class:`str() `:" -#: ../../library/enum.rst:725 +#: ../../library/enum.rst:729 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:726 +#: ../../library/enum.rst:730 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:728 +#: ../../library/enum.rst:732 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" @@ -1321,7 +1329,7 @@ msgstr "" "繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:737 +#: ../../library/enum.rst:741 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1329,11 +1337,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:742 +#: ../../library/enum.rst:746 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:744 +#: ../../library/enum.rst:748 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1357,13 +1365,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:758 +#: ../../library/enum.rst:762 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:761 +#: ../../library/enum.rst:765 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1385,7 +1393,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:773 +#: ../../library/enum.rst:777 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1393,7 +1401,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:776 +#: ../../library/enum.rst:780 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1421,24 +1429,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:790 +#: ../../library/enum.rst:794 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:796 +#: ../../library/enum.rst:800 msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:801 +#: ../../library/enum.rst:805 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:804 +#: ../../library/enum.rst:808 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1466,13 +1474,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:823 msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:822 +#: ../../library/enum.rst:826 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1492,13 +1500,13 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:833 +#: ../../library/enum.rst:837 msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:850 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" @@ -1506,7 +1514,7 @@ msgstr "" "範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " "的預設行為: ::" -#: ../../library/enum.rst:849 +#: ../../library/enum.rst:853 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1526,7 +1534,7 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:866 msgid "" "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " "defining enum classes (see :ref:`prepare`). It is exposed to allow " @@ -1540,7 +1548,7 @@ msgstr "" "如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" "稱和內部類別將無法被正確處理。" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:873 msgid "" "Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" "`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " @@ -1551,15 +1559,15 @@ msgstr "" "__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" "dict` 操作來繞過檢查,例如 :meth:`|= `。" -#: ../../library/enum.rst:876 +#: ../../library/enum.rst:880 msgid "A list of member names." msgstr "一個成員名稱的串列。" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:887 msgid "Supported ``__dunder__`` names" msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:885 +#: ../../library/enum.rst:889 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1567,7 +1575,7 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:888 +#: ../../library/enum.rst:892 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " @@ -1577,26 +1585,26 @@ msgstr "" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:894 +#: ../../library/enum.rst:898 msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:900 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:897 +#: ../../library/enum.rst:901 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:898 +#: ../../library/enum.rst:902 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:900 +#: ../../library/enum.rst:904 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 " @@ -1605,7 +1613,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:903 +#: ../../library/enum.rst:907 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1613,40 +1621,40 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:905 +#: ../../library/enum.rst:909 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:910 +#: ../../library/enum.rst:914 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:917 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:916 +#: ../../library/enum.rst:920 msgid "" ":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" -#: ../../library/enum.rst:918 +#: ../../library/enum.rst:922 msgid "" ":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " "existing member." msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" -#: ../../library/enum.rst:921 +#: ../../library/enum.rst:925 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" @@ -1654,30 +1662,30 @@ msgstr "" "雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" "用,但有些是明確允許的:" -#: ../../library/enum.rst:924 +#: ../../library/enum.rst:928 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" "``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " "`_" -#: ../../library/enum.rst:926 +#: ../../library/enum.rst:930 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:927 +#: ../../library/enum.rst:931 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:928 +#: ../../library/enum.rst:932 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:934 +#: ../../library/enum.rst:938 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:938 +#: ../../library/enum.rst:942 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1693,16 +1701,16 @@ msgstr "" "`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" "說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" -#: ../../library/enum.rst:946 +#: ../../library/enum.rst:950 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:948 +#: ../../library/enum.rst:952 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:949 +#: ../../library/enum.rst:953 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1710,7 +1718,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:951 +#: ../../library/enum.rst:955 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1718,19 +1726,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:956 +#: ../../library/enum.rst:960 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:959 +#: ../../library/enum.rst:963 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:962 +#: ../../library/enum.rst:966 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1739,7 +1747,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的型別就會失敗。" -#: ../../library/enum.rst:968 +#: ../../library/enum.rst:972 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1748,7 +1756,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:972 +#: ../../library/enum.rst:976 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1758,7 +1766,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:985 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1768,7 +1776,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:985 +#: ../../library/enum.rst:989 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1794,7 +1802,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:999 +#: ../../library/enum.rst:1003 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1803,15 +1811,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:1007 +#: ../../library/enum.rst:1011 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:1013 +#: ../../library/enum.rst:1017 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:1019 +#: ../../library/enum.rst:1023 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1822,19 +1830,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:1029 +#: ../../library/enum.rst:1033 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:1036 +#: ../../library/enum.rst:1040 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:1038 +#: ../../library/enum.rst:1042 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:1040 +#: ../../library/enum.rst:1044 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1842,17 +1850,17 @@ msgstr "" "這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:1043 +#: ../../library/enum.rst:1047 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1045 +#: ../../library/enum.rst:1049 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1048 +#: ../../library/enum.rst:1052 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1860,7 +1868,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:1051 +#: ../../library/enum.rst:1055 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1870,11 +1878,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1055 +#: ../../library/enum.rst:1059 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1057 +#: ../../library/enum.rst:1061 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/exceptions.po b/library/exceptions.po index a928b9ed96..304ba827ae 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -839,7 +839,7 @@ msgid "" "attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" "對於發生在 f-string 欄位的錯誤,訊息會以 \"f-string: \" 為前綴,而偏移量 " -"(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" +"(offset) 是從替代運算式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" #: ../../library/exceptions.rst:560 diff --git a/library/fractions.po b/library/fractions.po index 722ae18f1a..03799a18f9 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,30 +32,30 @@ msgstr "" #: ../../library/fractions.rst:17 msgid "" -"A Fraction instance can be constructed from a pair of integers, from another " -"rational number, or from a string." +"A Fraction instance can be constructed from a pair of rational numbers, from " +"a single number, or from a string." msgstr "" #: ../../library/fractions.rst:26 msgid "" "The first version requires that *numerator* and *denominator* are instances " "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " -"with value ``numerator/denominator``. If *denominator* is ``0``, it raises " -"a :exc:`ZeroDivisionError`." +"with a value equal to ``numerator/denominator``. If *denominator* is zero, " +"it raises a :exc:`ZeroDivisionError`." msgstr "" #: ../../library/fractions.rst:31 msgid "" -"The second version requires that *number* is an instance " -"of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method " -"(this includes :class:`float` and :class:`decimal.Decimal`). It returns " -"a :class:`Fraction` instance with exactly the same value. Assumed, that " -"the :meth:`!as_integer_ratio` method returns a pair of coprime integers and " -"last one is positive. Note that due to the usual issues with binary point " -"(see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly " -"equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, " -"10)`` as one might expect. (But see the documentation for " -"the :meth:`limit_denominator` method below.)" +"The second version requires that *number* is an instance of :class:`numbers." +"Rational` or has the :meth:`!as_integer_ratio` method (this includes :class:" +"`float` and :class:`decimal.Decimal`). It returns a :class:`Fraction` " +"instance with exactly the same value. Assumed, that the :meth:`!" +"as_integer_ratio` method returns a pair of coprime integers and last one is " +"positive. Note that due to the usual issues with binary point (see :ref:`tut-" +"fp-issues`), the argument to ``Fraction(1.1)`` is not exactly equal to " +"11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as " +"one might expect. (But see the documentation for the :meth:" +"`limit_denominator` method below.)" msgstr "" #: ../../library/fractions.rst:43 @@ -73,10 +73,10 @@ msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by " -"the :class:`float` constructor is also accepted by the :class:`Fraction` " -"constructor. In either form the input string may also have leading and/or " -"trailing whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by the :class:" +"`float` constructor is also accepted by the :class:`Fraction` constructor. " +"In either form the input string may also have leading and/or trailing " +"whitespace. Here are some examples::" msgstr "" #: ../../library/fractions.rst:57 @@ -133,20 +133,20 @@ msgstr "" #: ../../library/fractions.rst:83 msgid "" -"The :class:`Fraction` class inherits from the abstract base " -"class :class:`numbers.Rational`, and implements all of the methods and " -"operations from that class. :class:`Fraction` instances " -"are :term:`hashable`, and should be treated as immutable. In " -"addition, :class:`Fraction` has the following properties and methods:" +"The :class:`Fraction` class inherits from the abstract base class :class:" +"`numbers.Rational`, and implements all of the methods and operations from " +"that class. :class:`Fraction` instances are :term:`hashable`, and should be " +"treated as immutable. In addition, :class:`Fraction` has the following " +"properties and methods:" msgstr "" #: ../../library/fractions.rst:89 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` " -"and :class:`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` and :class:" +"`decimal.Decimal` instances." msgstr "" -":class:`Fraction` 建構函式現在可接受 :class:`float` " -"和 :class:`decimal.Decimal` 實例。" +":class:`Fraction` 建構函式現在可接受 :class:`float` 和 :class:`decimal." +"Decimal` 實例。" #: ../../library/fractions.rst:93 msgid "" @@ -163,8 +163,8 @@ msgstr "" #: ../../library/fractions.rst:102 msgid "" -":class:`Fraction` implements ``__int__`` now to satisfy " -"``typing.SupportsInt`` instance checks." +":class:`Fraction` implements ``__int__`` now to satisfy ``typing." +"SupportsInt`` instance checks." msgstr "" #: ../../library/fractions.rst:106 @@ -190,99 +190,100 @@ msgid "" "The :class:`Fraction` constructor now accepts any objects with the :meth:`!" "as_integer_ratio` method." msgstr "" -":class:`Fraction` 建構函式現在可接受任何具有 :meth:`!as_integer_ratio` 方法的物件。" +":class:`Fraction` 建構函式現在可接受任何具有 :meth:`!as_integer_ratio` 方法的" +"物件。" #: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." msgstr "" #: ../../library/fractions.rst:128 -msgid "Denominator of the Fraction in lowest term." +msgid "Denominator of the Fraction in lowest terms. Guaranteed to be positive." msgstr "" -#: ../../library/fractions.rst:133 +#: ../../library/fractions.rst:134 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: ../../library/fractions.rst:141 +#: ../../library/fractions.rst:142 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: ../../library/fractions.rst:147 +#: ../../library/fractions.rst:148 msgid "" -"Alternative constructor which only accepts instances of :class:`float` " -"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " -"not the same value as ``Fraction(3, 10)``." +"Alternative constructor which only accepts instances of :class:`float` or :" +"class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " +"the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:153 +#: ../../library/fractions.rst:154 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:159 +#: ../../library/fractions.rst:160 msgid "" -"Alternative constructor which only accepts instances " -"of :class:`decimal.Decimal` or :class:`numbers.Integral`." +"Alternative constructor which only accepts instances of :class:`decimal." +"Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:164 +#: ../../library/fractions.rst:165 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:171 +#: ../../library/fractions.rst:172 msgid "" -"Alternative constructor which only accepts instances " -"of :class:`numbers.Integral`, :class:`numbers.Rational`, :class:`float` " -"or :class:`decimal.Decimal`, and objects with the :meth:`!as_integer_ratio` " -"method, but not strings." +"Alternative constructor which only accepts instances of :class:`numbers." +"Integral`, :class:`numbers.Rational`, :class:`float` or :class:`decimal." +"Decimal`, and objects with the :meth:`!as_integer_ratio` method, but not " +"strings." msgstr "" -#: ../../library/fractions.rst:181 +#: ../../library/fractions.rst:182 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:189 +#: ../../library/fractions.rst:190 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:202 +#: ../../library/fractions.rst:203 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:212 +#: ../../library/fractions.rst:213 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:219 +#: ../../library/fractions.rst:220 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through " -"the :func:`round` function." +"rounding half toward even. This method can also be accessed through the :" +"func:`round` function." msgstr "" -#: ../../library/fractions.rst:227 +#: ../../library/fractions.rst:228 msgid "" -"Provides support for formatting of :class:`Fraction` instances via " -"the :meth:`str.format` method, the :func:`format` built-in function, " -"or :ref:`Formatted string literals `." +"Provides support for formatting of :class:`Fraction` instances via the :meth:" +"`str.format` method, the :func:`format` built-in function, or :ref:" +"`Formatted string literals `." msgstr "" -#: ../../library/fractions.rst:231 +#: ../../library/fractions.rst:232 msgid "" "If the ``format_spec`` format specification string does not end with one of " "the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " @@ -294,7 +295,7 @@ msgid "" "exact integer. The zero-fill flag ``'0'`` is not supported." msgstr "" -#: ../../library/fractions.rst:241 +#: ../../library/fractions.rst:242 msgid "" "If the ``format_spec`` format specification string ends with one of the " "presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " @@ -302,11 +303,11 @@ msgid "" "type in the :ref:`formatspec` section." msgstr "" -#: ../../library/fractions.rst:246 +#: ../../library/fractions.rst:247 msgid "Here are some examples::" msgstr "" -#: ../../library/fractions.rst:248 +#: ../../library/fractions.rst:249 msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -346,11 +347,11 @@ msgstr "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" -#: ../../library/fractions.rst:270 +#: ../../library/fractions.rst:271 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:271 +#: ../../library/fractions.rst:272 msgid "The abstract base classes making up the numeric tower." msgstr "" diff --git a/library/functions.po b/library/functions.po index 9b4e6313e8..b7d0254a17 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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``。這個" @@ -500,13 +500,13 @@ msgstr "" #: ../../library/functions.rst:124 msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. Some examples:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" -"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *integer* 不是 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:194 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:220 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,12 +667,11 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:234 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* 肯定" @@ -727,8 +726,8 @@ msgstr "" #: ../../library/functions.rst:267 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` 中關" "於函式定義的詳細介紹。" @@ -756,30 +755,31 @@ msgstr "" #: ../../library/functions.rst:279 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:283 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:290 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:297 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:302 msgid "" @@ -816,16 +816,16 @@ msgstr "" #: ../../library/functions.rst:312 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:`未來功能 `。如果兩者都不存在" @@ -838,18 +838,16 @@ msgstr "" 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:331 msgid "" @@ -859,8 +857,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) 也被刪除)。" @@ -874,8 +872,8 @@ msgstr "" #: ../../library/functions.rst:340 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:343 ../../library/functions.rst:345 @@ -891,8 +889,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 更容易檢測陳述式的完整性。" @@ -985,23 +983,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:422 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__`。" @@ -1037,8 +1035,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__`。" @@ -1072,8 +1070,8 @@ msgstr "" #: ../../library/functions.rst:477 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。" @@ -1091,9 +1089,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__` " @@ -1105,12 +1103,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:500 msgid "" @@ -1167,30 +1165,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:556 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:568 msgid "Equivalent to::" @@ -1257,14 +1255,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* 對映分別用作全域和區域命名空間。如果 " @@ -1272,11 +1270,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:616 msgid "Example:" @@ -1301,8 +1299,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:632 msgid "" @@ -1344,18 +1342,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:672 msgid "" @@ -1385,9 +1383,9 @@ msgstr "" #: ../../library/functions.rst:688 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__`` 鍵值,則將為該鍵插入對內" @@ -1422,9 +1420,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:717 msgid "Added the *closure* parameter." @@ -1524,9 +1522,9 @@ msgstr "" #: ../../library/functions.rst:800 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__`。" @@ -1559,8 +1557,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:831 msgid "" @@ -1572,12 +1570,12 @@ msgstr "" #: ../../library/functions.rst:834 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 時,會忽略" @@ -1589,24 +1587,23 @@ 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:850 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:854 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 來了解其它的容器。" @@ -1622,16 +1619,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:871 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) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" @@ -1670,9 +1667,8 @@ msgstr "" #: ../../library/functions.rst:901 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` 將根據" "運行機器的位元長度來截斷回傳值。" @@ -1742,8 +1738,8 @@ msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基 #: ../../library/functions.rst:955 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。" @@ -1851,14 +1847,13 @@ msgstr "" #: ../../library/functions.rst:1021 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " -"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " -"returns ``x.__index__()``. 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__()``. For floating-point numbers, this truncates towards zero." msgstr "" -"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 會回傳 ``x.__int__()``。" -"如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。對於浮點" -"數,則會向零的方向無條件捨去。" +"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 會回傳 ``x." +"__int__()``。如果引數定義了 :meth:`~object.__index__` 則回傳 ``x." +"__index__()``。對於浮點數,則會向零的方向無條件捨去。" #: ../../library/functions.rst:1026 msgid "" @@ -1868,10 +1863,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:1032 msgid "" @@ -1901,15 +1896,15 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1045 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:1055 msgid "The first parameter is now positional-only." @@ -1927,14 +1922,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 "" @@ -1949,18 +1944,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:1085 ../../library/functions.rst:1099 msgid "*classinfo* can be a :ref:`types-union`." @@ -1968,18 +1963,18 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1091 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:1106 msgid "" @@ -1987,24 +1982,23 @@ msgid "" "differently depending on the presence of the second argument. Without a " "second argument, the single argument 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 the first " -"argument must be a callable object. The iterator created in this case will " -"call *callable* with no arguments for each call to " -"its :meth:`~iterator.__next__` method; if the value returned is equal to " -"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " -"returned." +"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 the first argument must be a " +"callable object. The iterator created in this case will call *callable* " +"with no arguments for each call to its :meth:`~iterator.__next__` method; if " +"the value returned is equal to *sentinel*, :exc:`StopIteration` will be " +"raised, otherwise the value will be returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" "常不同的。如果沒有第二個引數,該單一引數必須是支援 :term:`iterable` 協定" -"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" -"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" -"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引" -"數必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" -"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果" -"是 *sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :" +"meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些" +"協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引數必須" +"是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." +"__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果是 *sentinel* 則引發 :" +"exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1120 msgid "See also :ref:`typeiter`." @@ -2042,8 +2036,8 @@ msgstr "" #: ../../library/functions.rst:1140 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`。" @@ -2066,8 +2060,8 @@ msgstr "" #: ../../library/functions.rst:1158 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:1162 @@ -2128,10 +2122,10 @@ msgstr "" #: ../../library/functions.rst:1197 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:1207 @@ -2145,12 +2139,12 @@ msgid "" "cases where the function inputs are already arranged into argument tuples, " "see :func:`itertools.starmap`." msgstr "" -"產生一個將 *function* 應用於 *iterable* 中所有項目並 yield 回傳結果的" -"疊代器。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,且 *function* 會平行地被應用於所有可疊代物件的項目。當有多個可疊代物件時,項目最少的" -"可疊代物件耗盡時疊代器也會結束。如果 *strict* 為 ``True`` 且其中一個" -"可疊代物件在其他可疊代物件之前耗盡,則會拋出 :exc:`ValueError`。如果函式的輸入已經被編排為引數的元組," -"請參閱 :func:`itertools.starmap`。" +"產生一個將 *function* 應用於 *iterable* 中所有項目並 yield 回傳結果的疊代器。" +"如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的引數,且 " +"*function* 會平行地被應用於所有可疊代物件的項目。當有多個可疊代物件時,項目最" +"少的可疊代物件耗盡時疊代器也會結束。如果 *strict* 為 ``True`` 且其中一個可疊" +"代物件在其他可疊代物件之前耗盡,則會拋出 :exc:`ValueError`。如果函式的輸入已" +"經被編排為引數的元組,請參閱 :func:`itertools.starmap`。" #: ../../library/functions.rst:1216 msgid "Added the *strict* parameter." @@ -2176,20 +2170,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:1238 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, " @@ -2205,8 +2199,8 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1254 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`。" @@ -2239,14 +2233,13 @@ msgstr "" #: ../../library/functions.rst:1291 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:1298 msgid "" @@ -2270,9 +2263,9 @@ msgstr "" #: ../../library/functions.rst:1312 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. For example:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " "Python 運算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" @@ -2317,18 +2310,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:1366 msgid "Character" @@ -2457,9 +2450,9 @@ msgid "" "size is available. On most systems, the buffer will typically be 128 " "kilobytes long." msgstr "" -"二進位檔案會以固定大小的區塊進行緩衝;緩衝區的大小為 " -"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)``,當裝置區塊大小可用時。" -"在大多數系統上,緩衝區的長度通常為 128 KB。" +"二進位檔案會以固定大小的區塊進行緩衝;緩衝區的大小為 ``max(min(blocksize, 8 " +"MiB), DEFAULT_BUFFER_SIZE)``,當裝置區塊大小可用時。在大多數系統上,緩衝區的" +"長度通常為 128 KB。" #: ../../library/functions.rst:1410 msgid "" @@ -2488,9 +2481,8 @@ 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-" @@ -2584,10 +2576,10 @@ msgstr "" #: ../../library/functions.rst:1472 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* 是 " @@ -2624,8 +2616,8 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1491 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 ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" @@ -2642,40 +2634,49 @@ msgid "" "...\n" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" +">>> import os\n" +">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" +">>> def opener(path, flags):\n" +"... return os.open(path, flags, dir_fd=dir_fd)\n" +"...\n" +">>> with open('spamspam.txt', 'w', opener=opener) as f:\n" +"... print('This will be written to somedir/spamspam.txt', file=f)\n" +"...\n" +">>> os.close(dir_fd) # don't leak a file descriptor" #: ../../library/functions.rst:1504 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:1525 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:1529 msgid "" @@ -2708,8 +2709,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:1544 msgid "The file is now non-inheritable." @@ -2718,8 +2719,8 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1548 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`)。" @@ -2734,8 +2735,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1556 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`。" @@ -2752,8 +2753,8 @@ msgstr "" msgid "" "If the argument is a one-character string, return the Unicode code point of " "that character. For example, ``ord('a')`` returns the integer ``97`` and " -"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse " -"of :func:`chr`." +"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:" +"`chr`." msgstr "" "如果引數是單字元字串,則回傳該字元的 Unicode 編碼位置。例如 ``ord('a')`` 回傳" "整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆" @@ -2779,7 +2780,7 @@ msgstr "" #: ../../library/functions.rst:1583 msgid "" -"The arguments must have numeric types. With mixed operand types, the " +"When arguments are builtin numeric types with mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " "operands, the result has the same type as the operands (after coercion) " "unless the second argument is negative; in that case, all arguments are " @@ -2787,19 +2788,19 @@ 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` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``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``。" +"數且指數 (exponent) 為非整數,則會傳回複數結果。例如 ``pow(-9, 0.5)`` 會回傳" +"一個接近 ``3j`` 的值。然而,如果底數 (base) 是型別為 :class:`int` 或 :class:" +"`float` 的負數且指數為整數,則會傳回浮點數結果。例如 ``pow(-9, 2.0)`` 會回傳 " +"``81.0``。" #: ../../library/functions.rst:1595 msgid "" @@ -2950,12 +2951,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:1675 msgid "" @@ -3112,8 +3113,8 @@ msgstr "" #: ../../library/functions.rst:1790 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:1795 @@ -3134,9 +3135,9 @@ msgstr "" #: ../../library/functions.rst:1810 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:1817 @@ -3151,10 +3152,10 @@ msgstr "" #: ../../library/functions.rst:1823 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:1831 @@ -3182,16 +3183,14 @@ msgstr "" #: ../../library/functions.rst:1853 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:1858 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:1864 @@ -3206,9 +3205,8 @@ msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1868 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:1872 @@ -3270,8 +3268,8 @@ msgstr "" #: ../../library/functions.rst:1905 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` 中" "的詳細介紹。" @@ -3279,9 +3277,9 @@ msgstr "" #: ../../library/functions.rst:1908 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:1913 @@ -3320,15 +3318,15 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" #: ../../library/functions.rst:1931 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:1949 msgid "" @@ -3351,10 +3349,10 @@ msgstr "" #: ../../library/functions.rst:1961 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:1967 @@ -3388,17 +3386,17 @@ msgstr "" #: ../../library/functions.rst:1989 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:1993 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:1998 @@ -3481,15 +3479,15 @@ msgstr "" #: ../../library/functions.rst:2051 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:2055 msgid "" -":class:`super` objects are now :mod:`pickleable ` " -"and :mod:`copyable `." +":class:`super` objects are now :mod:`pickleable ` and :mod:" +"`copyable `." msgstr "" #: ../../library/functions.rst:2064 @@ -3501,8 +3499,8 @@ msgstr "" #: ../../library/functions.rst:2073 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:2077 @@ -3519,9 +3517,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:2095 @@ -3564,11 +3562,10 @@ msgstr "" #: ../../library/functions.rst:2117 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:2122 @@ -3623,15 +3620,15 @@ msgstr "" #: ../../library/functions.rst:2151 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:2155 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:2159 @@ -3688,8 +3685,8 @@ msgstr "" #: ../../library/functions.rst:2200 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:2204 diff --git a/library/functools.po b/library/functools.po index b803598b20..35b6b07dfe 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -147,9 +147,9 @@ msgstr "" #: ../../library/functools.rst:81 msgid "" -"The mechanics of :func:`cached_property` are somewhat different " -"from :func:`property`. A regular property blocks attribute writes unless a " -"setter is defined. In contrast, a *cached_property* allows writes." +"The mechanics of :func:`cached_property` are somewhat different from :func:" +"`property`. A regular property blocks attribute writes unless a setter is " +"defined. In contrast, a *cached_property* allows writes." msgstr "" ":func:`cached_property` 的機制與 :func:`property` 有所不同。除非定義了 " "setter,否則常規屬性會阻止屬性的寫入。相反地,*cached_property* 則允許寫入。" @@ -218,8 +218,8 @@ msgid "" "If a mutable mapping is not available or if space-efficient key sharing is " "desired, an effect similar to :func:`cached_property` can also be achieved " "by stacking :func:`property` on top of :func:`lru_cache`. See :ref:`faq-" -"cache-method-calls` for more details on how this differs " -"from :func:`cached_property`." +"cache-method-calls` for more details on how this differs from :func:" +"`cached_property`." msgstr "" "如果可變對映不可用或需要金鑰共享以節省空間,則也可以透過在 :func:`lru_cache` " "之上堆疊 :func:`property` 來實作類似於 :func:`cached_property` 的效果。請參閱" @@ -242,15 +242,16 @@ msgstr "" #: ../../library/functools.rst:130 msgid "" "Transform an old-style comparison function to a :term:`key function`. Used " -"with tools that accept key functions (such " -"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). " -"This function is primarily used as a transition tool for programs being " -"converted from Python 2 which supported the use of comparison functions." +"with tools that accept key functions (such as :func:`sorted`, :func:`min`, :" +"func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:" +"`itertools.groupby`). This function is primarily used as a transition tool " +"for programs being converted from Python 2 which supported the use of " +"comparison functions." msgstr "" "將舊式比較函式轉換為\\ :term:`鍵函式 `,能與接受鍵函式的工具一" -"起使用(例" -"如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq.nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。" -"此函式主要作為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" +"起使用(例如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq." +"nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。此函式主要作" +"為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" #: ../../library/functools.rst:137 msgid "" @@ -380,9 +381,9 @@ msgstr "裝飾器還提供了一個 :func:`!cache_clear` 函式來清除或使 #: ../../library/functools.rst:216 msgid "" -"The original underlying function is accessible through " -"the :attr:`__wrapped__` attribute. This is useful for introspection, for " -"bypassing the cache, or for rewrapping the function with a different cache." +"The original underlying function is accessible through the :attr:" +"`__wrapped__` attribute. This is useful for introspection, for bypassing " +"the cache, or for rewrapping the function with a different cache." msgstr "" "原本的底層函式可以透過 :attr:`__wrapped__` 屬性存取。這對於要自我檢查 " "(introspection)、繞過快取或使用不同的快取重新包裝函式時非常有用。" @@ -412,11 +413,10 @@ msgid "" "long-running processes such as web servers." msgstr "" "當最近的呼叫是即將發生之呼叫的最佳預測因子時(例如新聞伺服器上最受歡迎的文章" -"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ 能發揮最好的效果。" -"快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺服器)上無限制地成" -"長。" +"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ " +"能發揮最好的效果。快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺" +"服器)上無限制地成長。" #: ../../library/functools.rst:233 msgid "" @@ -472,10 +472,9 @@ msgstr "" #: ../../library/functools.rst:258 msgid "" -"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a " -"`dynamic programming `_ " -"technique::" +"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " +"programming `_ technique::" msgstr "" "使用快取來實作\\ `動態規劃 (dynamic programming) `_ 技法以有效率地計算\\ `費波那契數 (Fibonacci " @@ -530,15 +529,13 @@ msgstr "" #: ../../library/functools.rst:293 msgid "" -"The class must define one " -"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"or :meth:`~object.__ge__`. In addition, the class should supply " -"an :meth:`~object.__eq__` method." +"The class must define one of :meth:`~object.__lt__`, :meth:`~object." +"__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, the " +"class should supply an :meth:`~object.__eq__` method." msgstr "" -"類別必須定" -"義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提" -"供 :meth:`~object.__eq__` 方法。" +"類別必須定義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object." +"__gt__` 或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提供 :meth:" +"`~object.__eq__` 方法。" #: ../../library/functools.rst:299 msgid "" @@ -660,6 +657,10 @@ msgid "" ">>> basetwo('10010')\n" "18" msgstr "" +">>> basetwo = partial(int, base=2)\n" +">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" +">>> basetwo('10010')\n" +"18" #: ../../library/functools.rst:375 msgid "" @@ -682,6 +683,9 @@ msgid "" ">>> say_to_world('Hello', 'dear')\n" "Hello dear world!" msgstr "" +">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" +">>> say_to_world('Hello', 'dear')\n" +"Hello dear world!" #: ../../library/functools.rst:388 msgid "" @@ -692,11 +696,10 @@ msgstr "" #: ../../library/functools.rst:392 msgid "" -"If :func:`!partial` is applied to an existing :func:`!partial` " -"object, :data:`!Placeholder` sentinels of the input object are filled in " -"with new positional arguments. A placeholder can be retained by inserting a " -"new :data:`!Placeholder` sentinel to the place held by a previous :data:`!" -"Placeholder`:" +"If :func:`!partial` is applied to an existing :func:`!partial` object, :data:" +"`!Placeholder` sentinels of the input object are filled in with new " +"positional arguments. A placeholder can be retained by inserting a new :data:" +"`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" msgstr "" #: ../../library/functools.rst:398 @@ -713,6 +716,17 @@ msgid "" ">>> remove_first_dear(message)\n" "'Hello, dear world!'" msgstr "" +">>> from functools import partial, Placeholder as _\n" +">>> remove = partial(str.replace, _, _, '')\n" +">>> message = 'Hello, dear dear world!'\n" +">>> remove(message, ' dear')\n" +"'Hello, world!'\n" +">>> remove_dear = partial(remove, _, ' dear')\n" +">>> remove_dear(message)\n" +"'Hello, world!'\n" +">>> remove_first_dear = partial(remove_dear, _, 1)\n" +">>> remove_first_dear(message)\n" +"'Hello, dear world!'" #: ../../library/functools.rst:412 msgid "" @@ -726,12 +740,12 @@ msgstr "" #: ../../library/functools.rst:419 msgid "" -"Return a new :class:`partialmethod` descriptor which behaves " -"like :class:`partial` except that it is designed to be used as a method " -"definition rather than being directly callable." +"Return a new :class:`partialmethod` descriptor which behaves like :class:" +"`partial` except that it is designed to be used as a method definition " +"rather than being directly callable." msgstr "" -"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似" -"於 :class:`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" +"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似於 :class:" +"`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" #: ../../library/functools.rst:423 msgid "" @@ -743,25 +757,24 @@ msgstr "" #: ../../library/functools.rst:426 msgid "" -"When *func* is a descriptor (such as a normal Python " -"function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` " -"or another instance of :class:`partialmethod`), calls to ``__get__`` are " -"delegated to the underlying descriptor, and an appropriate :ref:`partial " -"object` returned as the result." +"When *func* is a descriptor (such as a normal Python function, :func:" +"`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or another " +"instance of :class:`partialmethod`), calls to ``__get__`` are delegated to " +"the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." msgstr "" -"當 *func* 是描述器時(例如普通的 Python 函" -"式、:func:`classmethod`、:func:`staticmethod`、:func:`~abc.abstractmethod` " -"或 :class:`partialmethod` 的另一個實例),對 ``__get__`` 的呼叫將被委託 " -"(delegated) 給底層描述器,且一個適當的 :ref:`partial 物件 `\\ 會被作為結果回傳。" +"當 *func* 是描述器時(例如普通的 Python 函式、:func:`classmethod`、:func:" +"`staticmethod`、:func:`~abc.abstractmethod` 或 :class:`partialmethod` 的另一" +"個實例),對 ``__get__`` 的呼叫將被委託 (delegated) 給底層描述器,且一個適當" +"的 :ref:`partial 物件 `\\ 會被作為結果回傳。" #: ../../library/functools.rst:432 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " "a method: the *self* argument will be inserted as the first positional " -"argument, even before the *args* and *keywords* supplied to " -"the :class:`partialmethod` constructor." +"argument, even before the *args* and *keywords* supplied to the :class:" +"`partialmethod` constructor." msgstr "" "當 *func* 是非描述器可呼叫物件 (non-descriptor callable) 時,會動態建立適當的" "繫結方法 (bound method)。當被作為方法使用時,其行為類似於普通的 Python 函式:" @@ -869,8 +882,8 @@ msgstr "" #: ../../library/functools.rst:494 msgid "" -"Transform a function into a :term:`single-dispatch ` :term:`generic function`." +"Transform a function into a :term:`single-dispatch ` :term:" +"`generic function`." msgstr "" "將函式轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" @@ -1036,8 +1049,8 @@ msgid "" "the :func:`~singledispatch.register` attribute can also be used in a " "functional form::" msgstr "" -"若要啟用註冊 :term:`lambdas` 和預先存在的函" -"式,:func:`~singledispatch.register` 屬性也能以函式形式使用: ::" +"若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:" +"`~singledispatch.register` 屬性也能以函式形式使用: ::" #: ../../library/functools.rst:579 msgid "" @@ -1129,13 +1142,13 @@ msgstr "" msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " -"function decorated with ``@singledispatch`` is registered for the " -"base :class:`object` type, which means it is used if no better " -"implementation is found." +"function decorated with ``@singledispatch`` is registered for the base :" +"class:`object` type, which means it is used if no better implementation is " +"found." msgstr "" "如果沒有為特定型別註冊實作,則使用其方法解析順序 (method resolution order) 來" -"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基" -"底 :class:`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" +"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" +"`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" #: ../../library/functools.rst:624 msgid "" @@ -1219,14 +1232,16 @@ msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。 #: ../../library/functools.rst:664 msgid "" -"The :func:`~singledispatch.register` attribute now " -"supports :class:`typing.Union` as a type annotation." -msgstr ":func:`~singledispatch.register` 屬性現在支援使用 :class:`typing.Union` 型別註釋。" +"The :func:`~singledispatch.register` attribute now supports :class:`typing." +"Union` as a type annotation." +msgstr "" +":func:`~singledispatch.register` 屬性現在支援使用 :class:`typing.Union` 型別" +"註釋。" #: ../../library/functools.rst:671 msgid "" -"Transform a method into a :term:`single-dispatch ` :term:`generic function`." +"Transform a method into a :term:`single-dispatch ` :term:" +"`generic function`." msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" @@ -1272,15 +1287,15 @@ msgstr "" #: ../../library/functools.rst:692 msgid "" -"``@singledispatchmethod`` supports nesting with other decorators such " -"as :func:`@classmethod`. Note that to allow for " -"``dispatcher.register``, ``singledispatchmethod`` must be the *outer most* " -"decorator. Here is the ``Negator`` class with the ``neg`` methods bound to " -"the class, rather than an instance of the class::" +"``@singledispatchmethod`` supports nesting with other decorators such as :" +"deco:`classmethod`. Note that to allow for ``dispatcher.register``, " +"``singledispatchmethod`` must be the *outer most* decorator. Here is the " +"``Negator`` class with the ``neg`` methods bound to the class, rather than " +"an instance of the class::" msgstr "" -"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例" -"如 :func:`@classmethod`。請注意,為了使 ``dispatcher.register`` " -"可用,``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " +"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例如 :" +"deco:`classmethod`。請注意,為了使 ``dispatcher.register`` 可用," +"``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" #: ../../library/functools.rst:698 @@ -1319,15 +1334,12 @@ msgstr "" #: ../../library/functools.rst:714 msgid "" -"The same pattern can be used for other similar " -"decorators: :func:`@staticmethod`, :func:`@abstractmethod`, " -"and others." +"The same pattern can be used for other similar decorators: :deco:" +"`staticmethod`, :deco:`~abc.abstractmethod`, and others." msgstr "" -"相同的模式可用於其他類似的裝飾" -"器::func:`@staticmethod`、:func:`@abstractmethod` " -"等。" +"相同的模式可用於其他類似的裝飾器::deco:`staticmethod`、:deco:`~abc.abstractmethod` 等。" -#: ../../library/functools.rst:723 +#: ../../library/functools.rst:722 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1335,21 +1347,23 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper " -"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, " -"and :attr:`~function.__doc__`, the documentation string) and " -"``WRAPPER_UPDATES`` (which updates the wrapper " -"function's :attr:`~function.__dict__`, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式" -"的 :attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__annotations__`、:attr:`~function.__type_params__` " -"和 :attr:`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ " -"(更新包裝器函式的 :attr:`~function.__dict__`,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." +"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" +"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" +"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" +"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:735 +#: ../../library/functools.rst:734 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1360,7 +1374,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:740 +#: ../../library/functools.rst:739 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1372,7 +1386,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:746 +#: ../../library/functools.rst:745 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1385,31 +1399,30 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:752 +#: ../../library/functools.rst:751 msgid "" -"The ``__wrapped__`` attribute is now automatically added. " -"The :attr:`~function.__annotations__` attribute is now copied by default. " -"Missing attributes no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複" -"製 :attr:`~function.__annotations__` 屬性。缺少的屬性不再觸" -"發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." +"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:757 +#: ../../library/functools.rst:756 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " -"even if that function defined a ``__wrapped__`` attribute. " -"(see :issue:`17482`)" +"even if that function defined a ``__wrapped__`` attribute. (see :issue:" +"`17482`)" msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:762 +#: ../../library/functools.rst:761 msgid "" "The :attr:`~function.__type_params__` attribute is now copied by default." msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:768 +#: ../../library/functools.rst:767 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1420,7 +1433,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:773 +#: ../../library/functools.rst:772 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1443,8 +1456,28 @@ msgid "" ">>> example.__doc__\n" "'Docstring'" msgstr "" +">>> from functools import wraps\n" +">>> def my_decorator(f):\n" +"... @wraps(f)\n" +"... def wrapper(*args, **kwds):\n" +"... print('Calling decorated function')\n" +"... return f(*args, **kwds)\n" +"... return wrapper\n" +"...\n" +">>> @my_decorator\n" +"... def example():\n" +"... \"\"\"Docstring\"\"\"\n" +"... print('Called example function')\n" +"...\n" +">>> example()\n" +"Calling decorated function\n" +"Called example function\n" +">>> example.__name__\n" +"'example'\n" +">>> example.__doc__\n" +"'Docstring'" -#: ../../library/functools.rst:794 +#: ../../library/functools.rst:793 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:`!" @@ -1453,11 +1486,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`!example` 的文件字串將會遺失。" -#: ../../library/functools.rst:802 +#: ../../library/functools.rst:801 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:804 +#: ../../library/functools.rst:803 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1465,7 +1498,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:810 +#: ../../library/functools.rst:809 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1473,7 +1506,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:816 +#: ../../library/functools.rst:815 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1481,21 +1514,21 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:822 +#: ../../library/functools.rst:821 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:825 +#: ../../library/functools.rst:824 msgid "" ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " -"attributes. There are some important differences. For instance, " -"the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes " -"are not created automatically." +"attributes. There are some important differences. For instance, the :attr:" +"`~definition.__name__` and :attr:`~definition.__doc__` attributes are not " +"created automatically." msgstr "" ":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" -"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性的。但有一些重要的區" -"別,例如,:attr:`~definition.__name__` 和 :attr:`~definition.__doc__` 屬性不會自動" -"建立。" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性的。但有一些重要的" +"區別,例如,:attr:`~definition.__name__` 和 :attr:`~definition.__doc__` 屬性" +"不會自動建立。" diff --git a/library/gc.po b/library/gc.po index 9d53e9812a..abcbc0941b 100644 --- a/library/gc.po +++ b/library/gc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-29 00:15+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,26 +69,26 @@ msgid "" "is raised if the generation number is invalid. The sum of collected objects " "and uncollectable objects is returned." msgstr "" -"啟動垃圾回收。可選的引數 *generation* 可以是一個指" -"明需要回收哪一代垃圾的整數(從 0 到 2)。當 generation 數值無效時,會引" -"發 :exc:`ValueError` 例外。可回收物件與不可回收物件的總和會被回傳。" +"啟動垃圾回收。可選的引數 *generation* 可以是一個指明需要回收哪一代垃圾的整數" +"(從 0 到 2)。當 generation 數值無效時,會引發 :exc:`ValueError` 例外。可回" +"收物件與不可回收物件的總和會被回傳。" #: ../../library/gc.rst:48 msgid "" "Calling ``gc.collect(0)`` will perform a GC collection on the young " "generation." -msgstr "" +msgstr "呼叫 ``gc.collect(0)`` 將對年輕代執行 GC 回收。" #: ../../library/gc.rst:50 msgid "" "Calling ``gc.collect(1)`` will perform a GC collection on the young " "generation and an increment of the old generation." -msgstr "" +msgstr "呼叫 ``gc.collect(1)`` 將對年輕代執行 GC 回收並對年老代執行增量回收。" #: ../../library/gc.rst:53 msgid "" "Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" -msgstr "" +msgstr "呼叫 ``gc.collect(2)`` 或 ``gc.collect()`` 執行完整回收" #: ../../library/gc.rst:55 msgid "" @@ -109,7 +109,7 @@ msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未 #: ../../library/gc.rst:63 msgid "``generation=1`` performs an increment of collection." -msgstr "" +msgstr "``generation=1`` 會執行增量收集。" #: ../../library/gc.rst:69 msgid "" @@ -139,7 +139,7 @@ msgstr "0: 年輕代中的所有物件。" #: ../../library/gc.rst:86 msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" -msgstr "1: 沒有物件,因為不存在第 1 代(截至 Python 3.14)" +msgstr "1: 沒有物件,因為不存在第一代(截至 Python 3.14)" #: ../../library/gc.rst:87 msgid "2: All objects in the old generation" @@ -151,7 +151,7 @@ msgstr "新增 *generation* 參數。" #: ../../library/gc.rst:92 msgid "Generation 1 is removed" -msgstr "" +msgstr "第一代已被刪除" #: ../../library/gc.rst:95 msgid "" @@ -187,8 +187,8 @@ msgid "" "uncollectable (and were therefore moved to the :data:`garbage` list) inside " "this generation." msgstr "" -"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移" -"到 :data:`garbage` list 中)。" +"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" +"`garbage` list 中)。" #: ../../library/gc.rst:118 msgid "" @@ -202,6 +202,8 @@ msgid "" "have survived a collection. New objects are placed in the young generation. " "If an object survives a collection it is moved into the old generation." msgstr "" +"GC 根據物件是否在回收中倖存下來而將其分為兩代。新的物件會被放置在年輕代中。如果一" +"個物件在回收中倖存下來,它將被移動到年老代中。" #: ../../library/gc.rst:125 msgid "" @@ -211,6 +213,9 @@ msgid "" "*threshold0*, collection starts. For each collection, all the objects in the " "young generation and some fraction of the old generation is collected." msgstr "" +"為了決定何時運行,回收器會追蹤自上次回收以來物件分配和釋放的數量。當分配數" +"量減去釋放數量超過 *threshold0* 時,回收就會開始。每次回收都會去回收年輕代中的所有物件" +"和年老代的部分物件。" #: ../../library/gc.rst:131 msgid "" @@ -219,6 +224,9 @@ msgid "" "by 10% since the last collection and the net number of object allocations " "has not exceeded 40 times *threshold0*, the collection is not run." msgstr "" +"在自由執行緒建置 (free-threaded build) 中,在運行回收器之前還會檢查行程記憶體使用量的" +"增加。如果自上次回收以來記憶體使用量未增加 10%,且物件分配的淨數量未超過 *threshold0* " +"的 40 倍,則不會運行回收。" #: ../../library/gc.rst:136 msgid "" @@ -227,20 +235,24 @@ msgid "" "in the old generation are collected. For the default value of 10, 1% of the " "old generation is scanned during each collection." msgstr "" +"年老代中被回收的物件比例與 *threshold1* 成\\ **反比**。*threshold1* 越大,年老代中" +"物件的回收就越慢。以預設值 10 來說,每次回收時會掃描年老代中的 1%。" #: ../../library/gc.rst:141 msgid "*threshold2* is ignored." -msgstr "" +msgstr "*threshold2* 會被忽略。" #: ../../library/gc.rst:143 msgid "" -"See `Garbage collector design `_ for more information." +"See `Garbage collector design `_ for more information." msgstr "" +"有關更多資訊,請參閱\\ `垃圾回收器設計 `_。" #: ../../library/gc.rst:145 msgid "*threshold2* is ignored" -msgstr "" +msgstr "*threshold2* 會被忽略" #: ../../library/gc.rst:151 msgid "" @@ -292,35 +304,34 @@ msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " -"``gc.get_referrers``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." +"get_referrers``。" #: ../../library/gc.rst:184 msgid "" "Return a list of objects directly referred to by any of the arguments. The " -"referents returned are those objects visited by the arguments' C-" -"level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be " -"all objects actually directly " -"reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only " -"by objects that support garbage collection, and are only required to visit " -"objects that may be involved in a cycle. So, for example, if an integer is " -"directly reachable from an argument, that integer object may or may not " -"appear in the result list." +"referents returned are those objects visited by the arguments' C-level :c:" +"member:`~PyTypeObject.tp_traverse` methods (if any), and may not be all " +"objects actually directly reachable. :c:member:`~PyTypeObject.tp_traverse` " +"methods are supported only by objects that support garbage collection, and " +"are only required to visit objects that may be involved in a cycle. So, for " +"example, if an integer is directly reachable from an argument, that integer " +"object may or may not appear in the result list." msgstr "" "回傳包含被任意一個引數直接參照之物件的 list。回傳的被參照物件是有被引數的 C " "語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)瀏覽到的物件,可" -"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支" -"援 :c:member:`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈" -"的物件。因此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件" -"有可能出現或不出現在結果的 list 當中。" +"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支援 :c:member:" +"`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈的物件。因" +"此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" +"或不出現在結果的 list 當中。" #: ../../library/gc.rst:192 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " -"``gc.get_referents``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." +"get_referents``。" #: ../../library/gc.rst:196 msgid "" @@ -417,9 +428,9 @@ msgstr "" "如果一個行程將在沒有 ``exec()`` 的情況下進行 ``fork()``,避免子行程中不必要的" "寫入時複製將最大化記憶體共享並減少整體記憶體使用。這需要避免在父行程的記憶體" "頁面中建立已釋放的「漏洞」,並確保子行程中的 GC 收集不會觸及源自父行程的長壽" -"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 " -"``gc.disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼" -"叫 ``gc.enable()``。" +"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 ``gc." +"disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " +"``gc.enable()``。" #: ../../library/gc.rst:257 msgid "" @@ -458,22 +469,22 @@ msgstr "" #: ../../library/gc.rst:283 msgid "" -"If this list is non-empty at :term:`interpreter shutdown`, " -"a :exc:`ResourceWarning` is emitted, which is silent by default. " -"If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable " -"objects are printed." +"If this list is non-empty at :term:`interpreter shutdown`, a :exc:" +"`ResourceWarning` is emitted, which is silent by default. If :const:" +"`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable objects are " +"printed." msgstr "" -"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產" -"生 :exc:`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定" -"了 :const:`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" +"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產生 :exc:" +"`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" +"`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" #: ../../library/gc.rst:289 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." msgstr "" -"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會" -"在 :data:`gc.garbage` 內。" +"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" +"`gc.garbage` 內。" #: ../../library/gc.rst:295 msgid "" diff --git a/library/glob.po b/library/glob.po index 6eba211699..b2f5820851 100644 --- a/library/glob.po +++ b/library/glob.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-10-21 00:14+0000\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,30 +29,35 @@ msgstr "**原始碼:**\\ :source:`Lib/glob.py`" #: ../../library/glob.rst:21 msgid "" -"The :mod:`glob` module finds all the pathnames matching a specified pattern " -"according to the rules used by the Unix shell, although results are returned " -"in arbitrary order. No tilde expansion is done, but ``*``, ``?``, and " +"The :mod:`!glob` module finds pathnames using pattern matching rules similar " +"to the Unix shell. No tilde expansion is done, but ``*``, ``?``, and " "character ranges expressed with ``[]`` will be correctly matched. This is " "done by using the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions " "in concert, and not by actually invoking a subshell." msgstr "" -":mod:`glob` 模組根據 Unix shell 使用的規則查找與指定模式匹配的所有路徑名稱," -"結果以任意順序回傳。沒有波浪號 (tilde) 擴展,但是 ``*``、``?`` 和用 ``[]`` 表" -"示的字元範圍將被正確匹配。這是透過同時使用 :func:`os.scandir` 和 :func:" -"`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" +":mod:`!glob` 模組使用類似於 Unix shell 的模式匹配規則來尋找路徑名稱。不會進" +"行波浪號擴展 (tilde expansion) ,但 ``*``、``?`` 和使用 ``[]`` 表達的字元範圍將會被正確匹配。這" +"是透過結合使用 :func:`os.scandir` 和 :func:`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" -#: ../../library/glob.rst:28 +#: ../../library/glob.rst:29 msgid "" -"Note that files beginning with a dot (``.``) can only be matched by patterns " -"that also start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib." -"Path.glob`. (For tilde and shell variable expansion, use :func:`os.path." -"expanduser` and :func:`os.path.expandvars`.)" +"The pathnames are returned in no particular order. If you need a specific " +"order, sort the results." msgstr "" -"請注意,以點 (``.``) 開頭的檔案只能與同樣以點開頭的模式匹配,這與 :func:" -"`fnmatch.fnmatch` 或 :func:`pathlib.Path.glob` 不同。(對於波浪號和 shell 變" -"數擴展,請使用 :func:`os.path.expanduser` 和 :func:`os.path.expandvars`。)" +"路徑名稱不會以特定順序回傳。如果你需要特定的順序,請對結果進行排序。" -#: ../../library/glob.rst:34 +#: ../../library/glob.rst:32 +msgid "" +"Files beginning with a dot (``.``) can only be matched by patterns that also " +"start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib.Path." +"glob`. For tilde and shell variable expansion, use :func:`os.path." +"expanduser` and :func:`os.path.expandvars`." +msgstr "" +"以點 (``.``) 開頭的檔案只能與同樣以點開頭的模式匹配,這與 :func:" +"`fnmatch.fnmatch` 或 :func:`pathlib.Path.glob` 不同。對於波浪號和 shell 變" +"數擴展,請使用 :func:`os.path.expanduser` 和 :func:`os.path.expandvars`。" + +#: ../../library/glob.rst:38 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``'[?]'`` matches the character ``'?'``." @@ -60,11 +65,11 @@ msgstr "" "對於文本 (literal) 匹配,將元字元 (meta-character) 括在方括號中。例如," "``'[?]'`` 會匹配 ``'?'`` 字元。" -#: ../../library/glob.rst:37 -msgid "The :mod:`glob` module defines the following functions:" -msgstr ":mod:`glob` 模組定義了以下函式:" +#: ../../library/glob.rst:41 +msgid "The :mod:`!glob` module defines the following functions:" +msgstr ":mod:`!glob` 模組定義了以下函式:" -#: ../../library/glob.rst:43 +#: ../../library/glob.rst:47 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -82,25 +87,25 @@ msgstr "" "取決於檔案系統 (file system)。如果在呼叫此函式期間刪除或新增滿足條件的檔案," "則結果不一定會包含該檔案的路徑名稱。" -#: ../../library/glob.rst:52 +#: ../../library/glob.rst:56 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" -"func:`glob` as changing the current directory before calling it. If " +"func:`!glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" "如果 *root_dir* 不是 ``None``,它應該是一個指定搜尋根目錄的 :term:`path-like " -"object`。它在呼叫它之前更改目前目錄的影響與 :func:`glob` 相同。如果 " +"object`。它在呼叫它之前更改目前目錄的影響與 :func:`!glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" -#: ../../library/glob.rst:58 +#: ../../library/glob.rst:62 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" "此函式可以支援以 *dir_fd* 參數使用\\ :ref:`相對目錄描述器的路徑 `。" -#: ../../library/glob.rst:64 +#: ../../library/glob.rst:68 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -111,13 +116,13 @@ msgstr "" "和目錄的符號連結。如果模式後面有 :data:`os.sep` 或 :data:`os.altsep` 那麼檔案" "將不會被匹配。" -#: ../../library/glob.rst:69 +#: ../../library/glob.rst:73 msgid "" "If *include_hidden* is true, \"``**``\" pattern will match hidden " "directories." msgstr "如果 *include_hidden* 為真,\"``**``\" 模式將匹配被隱藏的目錄。" -#: ../../library/glob.rst:71 ../../library/glob.rst:98 +#: ../../library/glob.rst:75 ../../library/glob.rst:102 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." @@ -125,7 +130,7 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive`` 的\\ :ref:`稽核事件 ` " "``glob.glob``。" -#: ../../library/glob.rst:72 ../../library/glob.rst:99 +#: ../../library/glob.rst:76 ../../library/glob.rst:103 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." @@ -133,31 +138,31 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive``、``root_dir``、``dir_fd`` 的\\ :" "ref:`稽核事件 ` ``glob.glob/2``。" -#: ../../library/glob.rst:75 +#: ../../library/glob.rst:79 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "在大型目錄樹中使用 \"``**``\" 模式可能會消耗過多的時間。" -#: ../../library/glob.rst:79 ../../library/glob.rst:102 +#: ../../library/glob.rst:83 ../../library/glob.rst:106 msgid "" "This function may return duplicate path names if *pathname* contains " "multiple \"``**``\" patterns and *recursive* is true." msgstr "" -#: ../../library/glob.rst:82 ../../library/glob.rst:105 +#: ../../library/glob.rst:86 ../../library/glob.rst:109 msgid "Support for recursive globs using \"``**``\"." msgstr "支援以 \"``**``\" 使用遞迴 glob。" -#: ../../library/glob.rst:85 ../../library/glob.rst:108 +#: ../../library/glob.rst:89 ../../library/glob.rst:112 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "新增 *root_dir* 與 *dir_fd* 參數。" -#: ../../library/glob.rst:88 ../../library/glob.rst:111 +#: ../../library/glob.rst:92 ../../library/glob.rst:115 msgid "Added the *include_hidden* parameter." msgstr "新增 *include_hidden* 參數。" -#: ../../library/glob.rst:95 +#: ../../library/glob.rst:99 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." @@ -165,7 +170,7 @@ msgstr "" "回傳一個會產生與 :func:`glob` 相同的值的 :term:`iterator` ,而不是同時儲存全" "部的值。" -#: ../../library/glob.rst:117 +#: ../../library/glob.rst:121 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -178,52 +183,52 @@ msgstr "" "(sharepoints) 中的特殊字元不會被跳脫,例如在 Windows 上,``escape('//?/c:/" "Quo vadis?.txt')`` 會回傳 ``'//?/c:/Quo vadis[?].txt'``。" -#: ../../library/glob.rst:128 +#: ../../library/glob.rst:132 msgid "" "Convert the given path specification to a regular expression for use with :" "func:`re.match`. The path specification can contain shell-style wildcards." msgstr "" -#: ../../library/glob.rst:131 +#: ../../library/glob.rst:135 msgid "For example:" msgstr "舉例來說:" -#: ../../library/glob.rst:142 +#: ../../library/glob.rst:146 msgid "" "Path separators and segments are meaningful to this function, unlike :func:" "`fnmatch.translate`. By default wildcards do not match path separators, and " "``*`` pattern segments match precisely one path segment." msgstr "" -#: ../../library/glob.rst:146 +#: ../../library/glob.rst:150 msgid "" "If *recursive* is true, the pattern segment \"``**``\" will match any number " "of path segments." msgstr "" -#: ../../library/glob.rst:149 +#: ../../library/glob.rst:153 msgid "" "If *include_hidden* is true, wildcards can match path segments that start " "with a dot (``.``)." msgstr "" -#: ../../library/glob.rst:152 +#: ../../library/glob.rst:156 msgid "" "A sequence of path separators may be supplied to the *seps* argument. If not " "given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." msgstr "" -#: ../../library/glob.rst:157 +#: ../../library/glob.rst:161 msgid "" ":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " "which call this function to implement pattern matching and globbing." msgstr "" -#: ../../library/glob.rst:165 +#: ../../library/glob.rst:169 msgid "Examples" msgstr "範例" -#: ../../library/glob.rst:167 +#: ../../library/glob.rst:171 msgid "" "Consider a directory containing the following files: :file:`1.gif`, :file:`2." "txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " @@ -234,7 +239,7 @@ msgstr "" "gif`,和一個僅包含 :file:`3.txt` 檔案的子目錄 :file:`sub`,:func:`glob` 將產" "生以下結果。請注意路徑的任何前導部分是如何保留的。 ::" -#: ../../library/glob.rst:173 +#: ../../library/glob.rst:177 msgid "" ">>> import glob\n" ">>> glob.glob('./[0-9].*')\n" @@ -260,7 +265,7 @@ msgstr "" ">>> glob.glob('./**/', recursive=True)\n" "['./', './sub/']" -#: ../../library/glob.rst:185 +#: ../../library/glob.rst:189 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" @@ -269,7 +274,7 @@ msgstr "" "如果目錄包含以 ``.`` 開頭的檔案,則預設情況下不會去匹配到它們。例如,一個包" "含 :file:`card.gif` 和 :file:`.card.gif` 的目錄: ::" -#: ../../library/glob.rst:189 +#: ../../library/glob.rst:193 msgid "" ">>> import glob\n" ">>> glob.glob('*.gif')\n" @@ -283,12 +288,12 @@ msgstr "" ">>> glob.glob('.c*')\n" "['.card.gif']" -#: ../../library/glob.rst:196 +#: ../../library/glob.rst:200 msgid "" "The :mod:`fnmatch` module offers shell-style filename (not path) expansion." msgstr ":mod:`fnmatch` 模組提供了 shell 風格檔案名(不是路徑)的擴展" -#: ../../library/glob.rst:199 +#: ../../library/glob.rst:203 msgid "The :mod:`pathlib` module offers high-level path objects." msgstr ":mod:`pathlib` 模組提供高階路徑物件。" @@ -304,7 +309,7 @@ msgstr "pathname expansion(路徑名稱展開)" msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/glob.rst:13 ../../library/glob.rst:61 +#: ../../library/glob.rst:13 ../../library/glob.rst:65 msgid "in glob-style wildcards" msgstr "於 glob 風格的萬用字元中" @@ -328,6 +333,6 @@ msgstr "- (減號)" msgid ". (dot)" msgstr ". (點)" -#: ../../library/glob.rst:61 +#: ../../library/glob.rst:65 msgid "**" msgstr "**" diff --git a/library/hashlib.po b/library/hashlib.po index 9c32394b8f..91b8e4ca77 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-24 05:58+0000\n" +"POT-Creation-Date: 2025-10-03 00:13+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,8 +43,8 @@ msgstr "" #: ../../library/hashlib.rst:31 msgid "" -"If you want the adler32 or crc32 hash functions, they are available in " -"the :mod:`zlib` module." +"If you want the adler32 or crc32 hash functions, they are available in the :" +"mod:`zlib` module." msgstr "" "如果你需要 adler32 或 crc32 雜湊函式,可以在 :mod:`zlib` 模組中找到它們。" @@ -55,13 +55,13 @@ msgstr "雜湊演算法" #: ../../library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " -"return a hash object with the same simple interface. For example: " -"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " -"object with :term:`bytes-like objects ` " -"(normally :class:`bytes`) using the :meth:`update` method. At " -"any point you can ask it for the :dfn:`digest` of the concatenation of the " -"data fed to it so far using the :meth:`digest()` " -"or :meth:`hexdigest()` methods." +"return a hash object with the same simple interface. For example: use :func:" +"`sha256` to create a SHA-256 hash object. You can now feed this object with :" +"term:`bytes-like objects ` (normally :class:`bytes`) " +"using the :meth:`update` method. At any point you can ask it " +"for the :dfn:`digest` of the concatenation of the data fed to it so far " +"using the :meth:`digest()` or :meth:`hexdigest()` methods." msgstr "" "每種種類的 :dfn:`hash` 都有一個以其命名的建構函式方法。全部都會回傳具有相同簡" "單介面的雜湊物件。例如:可使用 :func:`sha256` 來建立 SHA-256 雜湊物件。現在你" @@ -74,8 +74,8 @@ msgstr "" #: ../../library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " -"a hash supplied more than 2047 bytes of data at once in its constructor " -"or :meth:`.update` method." +"a hash supplied more than 2047 bytes of data at once in its constructor or :" +"meth:`.update` method." msgstr "" "為了允許多執行緒 (multithreading),Python :term:`GIL` 被釋放,同時在其建構函" "式或 :meth:`.update` 方法中計算一次提供超過 2047 位元組資料的雜" @@ -83,25 +83,27 @@ msgstr "" #: ../../library/hashlib.rst:55 msgid "" -"Constructors for hash algorithms that are always present in this module " -"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " -"and :func:`blake2s`. :func:`md5` is normally available as well, though it " -"may be missing or blocked if you are using a rare \"FIPS compliant\" build " -"of Python. These correspond to :data:`algorithms_guaranteed`." -msgstr "" -"此模組中始終存在的雜湊演算法之建構函式" -"有 :func:`sha1`、:func:`sha224`、:func:`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`、:func:`blake2b` " -"和 :func:`blake2s`。:func:`md5` 通常也可用,但如果你使用罕見的「符合 FIPS " -"(FIPS compliant)」的 Python 建置版本,它可能不存在或者不被允許使用。以上會對" -"應到 :data:`algorithms_guaranteed`。" +"Constructors for hash algorithms that are always present in this module are :" +"func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" +"`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:" +"`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:" +"`blake2s`. :func:`md5` is normally available as well, though it may be " +"missing or blocked if you are using a rare \"FIPS compliant\" build of " +"Python. These correspond to :data:`algorithms_guaranteed`." +msgstr "" +"此模組中始終存在的雜湊演算法之建構函式有 :func:`sha1`、:func:`sha224`、:func:" +"`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:" +"`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:" +"`shake_256`、:func:`blake2b` 和 :func:`blake2s`。:func:`md5` 通常也可用,但如" +"果你使用罕見的「符合 FIPS (FIPS compliant)」的 Python 建置版本,它可能不存在" +"或者不被允許使用。以上會對應到 :data:`algorithms_guaranteed`。" #: ../../library/hashlib.rst:63 msgid "" -"Additional algorithms may also be available if your Python " -"distribution's :mod:`hashlib` was linked against a build of OpenSSL that " -"provides others. Others *are not guaranteed available* on all installations " -"and will only be accessible by name via :func:`new`. " -"See :data:`algorithms_available`." +"Additional algorithms may also be available if your Python distribution's :" +"mod:`hashlib` was linked against a build of OpenSSL that provides others. " +"Others *are not guaranteed available* on all installations and will only be " +"accessible by name via :func:`new`. See :data:`algorithms_available`." msgstr "" "如果你的 Python 發行版的 :mod:`hashlib` 與提供其他演算法的 OpenSSL 版本鏈結," "也可能有其他演算法可用。其他則\\ *不保證可用*\\ 於在所有安裝上,並且只能以名" @@ -119,13 +121,13 @@ msgstr "" #: ../../library/hashlib.rst:74 msgid "" -"SHA3 (Keccak) and SHAKE " -"constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` " -"were added. :func:`blake2b` and :func:`blake2s` were added." +"SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" +"func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " +"added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -"新增了 SHA3 (Keccak) 和 SHAKE 建構函" -"式 :func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。" -"也新增了 :func:`blake2b` 和 :func:`blake2s`。" +"新增了 SHA3 (Keccak) 和 SHAKE 建構函式 :func:`sha3_224`、:func:`sha3_256`、:" +"func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。也新" +"增了 :func:`blake2b` 和 :func:`blake2s`。" #: ../../library/hashlib.rst:82 msgid "" @@ -172,7 +174,8 @@ msgid "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" @@ -182,7 +185,8 @@ msgstr "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" @@ -236,14 +240,14 @@ msgstr "" #: ../../library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " -"running Python interpreter. These names will be recognized when passed " -"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"running Python interpreter. These names will be recognized when passed to :" +"func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " "same algorithm may appear multiple times in this set under different names " "(thanks to OpenSSL)." msgstr "" -"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞" -"給 :func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。" -"相同的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" +"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞給 :" +"func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。相同" +"的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" #: ../../library/hashlib.rst:174 msgid "Hash Objects" @@ -295,8 +299,8 @@ msgid "" "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" "使用\\ :term:`類位元組物件 `\\ 來更新雜湊物件。重複呼叫相" -"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 " -"``m.update(a+b)``。" +"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 ``m." +"update(a+b)``。" #: ../../library/hashlib.rst:212 msgid "" @@ -304,9 +308,8 @@ msgid "" "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小" -"為 :attr:`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元" -"組。" +"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小為 :attr:" +"`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元組。" #: ../../library/hashlib.rst:219 msgid "" @@ -384,20 +387,20 @@ msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. *fileobj* must be opened in blocking mode, otherwise " -"a :exc:`BlockingIOError` may be raised." +"similar. *fileobj* must be opened in blocking mode, otherwise a :exc:" +"`BlockingIOError` may be raised." msgstr "" "*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" "檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " -"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引" -"發 :exc:`BlockingIOError`。" +"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引發 :exc:" +"`BlockingIOError`。" #: ../../library/hashlib.rst:276 msgid "" -"The function may bypass Python's I/O and use the file descriptor " -"from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " -"an unknown state after this function returns or raises. It is up to the " -"caller to close *fileobj*." +"The function may bypass Python's I/O and use the file descriptor from :meth:" +"`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in an unknown " +"state after this function returns or raises. It is up to the caller to close " +"*fileobj*." msgstr "" "該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase.fileno` 中的檔案描" "述器 (file descriptor)。在此函式回傳或引發後,必須假定 *fileobj* 處於未知狀" @@ -417,8 +420,8 @@ msgstr "範例:" #: ../../library/hashlib.rst:305 msgid "" -"Now raises a :exc:`BlockingIOError` if the file is opened in blocking mode. " -"Previously, spurious null bytes were added to the digest." +"Now raises a :exc:`BlockingIOError` if the file is opened in non-blocking " +"mode. Previously, spurious null bytes were added to the digest." msgstr "" #: ../../library/hashlib.rst:311 @@ -456,8 +459,8 @@ msgid "" msgstr "" "字串 *hash_name* 是 HMAC 的雜湊摘要演算法所需的名稱,例如 ``sha1`` 或 " "``sha256``。*password* 和 *salt* 被直譯為位元組緩衝區。應用程式和函式庫應為 " -"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例" -"如 :func:`os.urandom`)且大約 16 或更多位元組。" +"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例如 :" +"func:`os.urandom`)且大約 16 或更多位元組。" #: ../../library/hashlib.rst:330 msgid "" @@ -555,8 +558,8 @@ msgstr "" #: ../../library/hashlib.rst:392 msgid "" -"Hash objects from this module follow the API of standard " -"library's :mod:`hashlib` objects." +"Hash objects from this module follow the API of standard library's :mod:" +"`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" #: ../../library/hashlib.rst:397 @@ -770,17 +773,15 @@ msgstr "簡單雜湊" #: ../../library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " -"calling the appropriate constructor function (:func:`blake2b` " -"or :func:`blake2s`), then update it with the data by " -"calling :meth:`~hash.update` on the object, and, finally, get the digest out " -"of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` " -"for hex-encoded string)." +"calling the appropriate constructor function (:func:`blake2b` or :func:" +"`blake2s`), then update it with the data by calling :meth:`~hash.update` on " +"the object, and, finally, get the digest out of the object by calling :meth:" +"`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." msgstr "" "要計算某些資料的雜湊值,你應該首先透過呼叫適當的建構函式(:func:`blake2b` " -"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼" -"叫 :meth:`~hash.update` 來以資料對它更新,最後透過呼" -"叫 :meth:`~hash.digest`\\ (或對於十六進位編碼字串則" -"為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" +"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼叫 :meth:`~hash." +"update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" +"位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" #: ../../library/hashlib.rst:526 msgid "" @@ -826,9 +827,9 @@ msgstr "密鑰雜湊 (Keyed hashing)" #: ../../library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " -"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-" -"MAC mode thanks to the indifferentiability property inherited from BLAKE." +"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC " +"mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" "密鑰雜湊可用於身份驗證,作為\\ `基於雜湊的訊息驗證碼 (Hash-based message " "authentication code) `_ (HMAC) 的更快、" diff --git a/library/html.parser.po b/library/html.parser.po index a054929fb1..999f46dd86 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -572,6 +572,15 @@ msgid "" "Num ent : >\n" "Num ent : >" msgstr "" +">>> parser = MyHTMLParser()\n" +">>> parser.feed('>>>')\n" +"Data : >>>\n" +"\n" +">>> parser = MyHTMLParser(convert_charrefs=False)\n" +">>> parser.feed('>>>')\n" +"Named ent: >\n" +"Num ent : >\n" +"Num ent : >" #: ../../library/html.parser.rst:337 msgid "" diff --git a/library/http.po b/library/http.po index e2e24bae35..644e1e5a66 100644 --- a/library/http.po +++ b/library/http.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,13 +40,13 @@ msgid "" ":mod:`http.client` is a low-level HTTP protocol client; for high-level URL " "opening use :mod:`urllib.request`" msgstr "" -":mod:`http.client` 是一個低階的 HTTP 協定用戶端;對於高階的 URL 存取請使" -"用 :mod:`urllib.request`" +":mod:`http.client` 是一個低階的 HTTP 協定用戶端;對於高階的 URL 存取請使用 :" +"mod:`urllib.request`" #: ../../library/http.rst:20 msgid "" -":mod:`http.server` contains basic HTTP server classes based " -"on :mod:`socketserver`" +":mod:`http.server` contains basic HTTP server classes based on :mod:" +"`socketserver`" msgstr ":mod:`http.server` 包含基於 :mod:`socketserver` 的基本 HTTP 伺服器類別" #: ../../library/http.rst:21 @@ -74,8 +74,8 @@ msgstr "" ":class:`enum.IntEnum` 的子類別,它定義了一組 HTTP 狀態碼、原理短語 (reason " "phrase) 以及英文長描述。" -#: ../../library/http.rst:34 ../../library/http.rst:161 -#: ../../library/http.rst:175 +#: ../../library/http.rst:34 ../../library/http.rst:162 +#: ../../library/http.rst:176 msgid "Usage::" msgstr "用法: ::" @@ -116,8 +116,8 @@ msgstr "HTTP 狀態碼" #: ../../library/http.rst:55 msgid "" "Supported, `IANA-registered status codes `_ available " -"in :class:`http.HTTPStatus` are:" +"http-status-codes/http-status-codes.xhtml>`_ available in :class:`http." +"HTTPStatus` are:" msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" @@ -126,12 +126,12 @@ msgstr "" msgid "Code" msgstr "狀態碼" -#: ../../library/http.rst:60 ../../library/http.rst:208 +#: ../../library/http.rst:60 ../../library/http.rst:209 msgid "Enum Name" msgstr "列舉名稱" -#: ../../library/http.rst:60 ../../library/http.rst:152 -#: ../../library/http.rst:208 +#: ../../library/http.rst:60 ../../library/http.rst:153 +#: ../../library/http.rst:209 msgid "Details" msgstr "詳情" @@ -904,73 +904,75 @@ msgstr "" #: ../../library/http.rst:140 msgid "" "Implemented RFC9110 naming for status constants. Old constant names are " -"preserved for backwards compatibility." +"preserved for backwards compatibility: ``413 REQUEST_ENTITY_TOO_LARGE``, " +"``414 REQUEST_URI_TOO_LONG``, ``416 REQUESTED_RANGE_NOT_SATISFIABLE`` and " +"``422 UNPROCESSABLE_ENTITY``." msgstr "" -#: ../../library/http.rst:145 +#: ../../library/http.rst:146 msgid "HTTP status category" msgstr "HTTP 狀態分類" -#: ../../library/http.rst:149 +#: ../../library/http.rst:150 msgid "" "The enum values have several properties to indicate the HTTP status category:" msgstr "" -#: ../../library/http.rst:152 +#: ../../library/http.rst:153 msgid "Property" msgstr "" -#: ../../library/http.rst:152 +#: ../../library/http.rst:153 msgid "Indicates that" msgstr "" -#: ../../library/http.rst:154 +#: ../../library/http.rst:155 msgid "``is_informational``" msgstr "``is_informational``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:155 msgid "``100 <= status <= 199``" msgstr "``100 <= status <= 199``" -#: ../../library/http.rst:154 ../../library/http.rst:155 -#: ../../library/http.rst:156 ../../library/http.rst:157 -#: ../../library/http.rst:158 +#: ../../library/http.rst:155 ../../library/http.rst:156 +#: ../../library/http.rst:157 ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "HTTP Semantics :rfc:`9110`, Section 15" msgstr "HTTP Semantics :rfc:`9110`, Section 15" -#: ../../library/http.rst:155 +#: ../../library/http.rst:156 msgid "``is_success``" msgstr "``is_success``" -#: ../../library/http.rst:155 +#: ../../library/http.rst:156 msgid "``200 <= status <= 299``" msgstr "``200 <= status <= 299``" -#: ../../library/http.rst:156 +#: ../../library/http.rst:157 msgid "``is_redirection``" msgstr "``is_redirection``" -#: ../../library/http.rst:156 +#: ../../library/http.rst:157 msgid "``300 <= status <= 399``" msgstr "``300 <= status <= 399``" -#: ../../library/http.rst:157 +#: ../../library/http.rst:158 msgid "``is_client_error``" msgstr "``is_client_error``" -#: ../../library/http.rst:157 +#: ../../library/http.rst:158 msgid "``400 <= status <= 499``" msgstr "``400 <= status <= 499``" -#: ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "``is_server_error``" msgstr "``is_server_error``" -#: ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "``500 <= status <= 599``" msgstr "``500 <= status <= 599``" -#: ../../library/http.rst:163 +#: ../../library/http.rst:164 msgid "" ">>> from http import HTTPStatus\n" ">>> HTTPStatus.OK.is_success\n" @@ -984,13 +986,13 @@ msgstr "" ">>> HTTPStatus.OK.is_client_error\n" "False" -#: ../../library/http.rst:173 +#: ../../library/http.rst:174 msgid "" "A subclass of :class:`enum.StrEnum` that defines a set of HTTP methods and " "descriptions written in English." msgstr ":class:`enum.StrEnum` 的子類別,它定義了一組 HTTP 方法以及英文描述。" -#: ../../library/http.rst:177 +#: ../../library/http.rst:178 msgid "" ">>> from http import HTTPMethod\n" ">>>\n" @@ -1034,11 +1036,11 @@ msgstr "" " ,\n" " ]" -#: ../../library/http.rst:201 +#: ../../library/http.rst:202 msgid "HTTP methods" msgstr "HTTP 方法" -#: ../../library/http.rst:203 +#: ../../library/http.rst:204 msgid "" "Supported, `IANA-registered methods `_ available in :class:`http.HTTPMethod` are:" @@ -1046,79 +1048,79 @@ msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" -#: ../../library/http.rst:208 +#: ../../library/http.rst:209 msgid "Method" msgstr "方法" -#: ../../library/http.rst:210 +#: ../../library/http.rst:211 msgid "``GET``" msgstr "``GET``" -#: ../../library/http.rst:210 +#: ../../library/http.rst:211 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.1" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.1" -#: ../../library/http.rst:211 +#: ../../library/http.rst:212 msgid "``HEAD``" msgstr "``HEAD``" -#: ../../library/http.rst:211 +#: ../../library/http.rst:212 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.2" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.2" -#: ../../library/http.rst:212 +#: ../../library/http.rst:213 msgid "``POST``" msgstr "``POST``" -#: ../../library/http.rst:212 +#: ../../library/http.rst:213 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.3" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.3" -#: ../../library/http.rst:213 +#: ../../library/http.rst:214 msgid "``PUT``" msgstr "``PUT``" -#: ../../library/http.rst:213 +#: ../../library/http.rst:214 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.4" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.4" -#: ../../library/http.rst:214 +#: ../../library/http.rst:215 msgid "``DELETE``" msgstr "``DELETE``" -#: ../../library/http.rst:214 +#: ../../library/http.rst:215 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.5" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.5" -#: ../../library/http.rst:215 +#: ../../library/http.rst:216 msgid "``CONNECT``" msgstr "``CONNECT``" -#: ../../library/http.rst:215 +#: ../../library/http.rst:216 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.6" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.6" -#: ../../library/http.rst:216 +#: ../../library/http.rst:217 msgid "``OPTIONS``" msgstr "``OPTIONS``" -#: ../../library/http.rst:216 +#: ../../library/http.rst:217 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.7" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.7" -#: ../../library/http.rst:217 +#: ../../library/http.rst:218 msgid "``TRACE``" msgstr "``TRACE``" -#: ../../library/http.rst:217 +#: ../../library/http.rst:218 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.8" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.8" -#: ../../library/http.rst:218 +#: ../../library/http.rst:219 msgid "``PATCH``" msgstr "``PATCH``" -#: ../../library/http.rst:218 +#: ../../library/http.rst:219 msgid "HTTP/1.1 :rfc:`5789`" msgstr "HTTP/1.1 :rfc:`5789`" diff --git a/library/idle.po b/library/idle.po index 3aaf2acd70..9bba58a62b 100644 --- a/library/idle.po +++ b/library/idle.po @@ -698,7 +698,7 @@ msgstr "" #: ../../library/idle.rst:345 msgid "Python Docs" -msgstr "" +msgstr "Python 文件" #: ../../library/idle.rst:346 msgid "" @@ -1177,7 +1177,7 @@ msgstr "" #: ../../library/idle.rst:667 msgid "python -m idlelib [options] [file ...]" -msgstr "" +msgstr "python -m idlelib [options] [file ...]" #: ../../library/idle.rst:671 msgid "The following options are available:" diff --git a/library/imaplib.po b/library/imaplib.po index fb45e859d2..48f89ff653 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -423,6 +423,12 @@ msgid "" "EXISTS [b'1']\n" "RECENT [b'1']" msgstr "" +">>> with M.idle(duration=29 * 60) as idler:\n" +"... for typ, data in idler:\n" +"... print(typ, data)\n" +"...\n" +"EXISTS [b'1']\n" +"RECENT [b'1']" #: ../../library/imaplib.rst:349 msgid "" diff --git a/library/importlib.po b/library/importlib.po index 03ed501d9f..6e27335e78 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-17 00:14+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-" @@ -42,9 +42,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 "" @@ -88,8 +88,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 @@ -230,11 +230,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 "" @@ -346,11 +346,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 @@ -363,16 +363,15 @@ 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:210 msgid "" "This function is not thread-safe. Calling it from multiple threads can " -"result in unexpected behavior. It's recommended to use " -"the :class:`threading.Lock` or other synchronization primitives for thread-" -"safe module reloading." +"result in unexpected behavior. It's recommended to use the :class:`threading." +"Lock` or other synchronization primitives for thread-safe module reloading." msgstr "" #: ../../library/importlib.rst:215 @@ -451,27 +450,26 @@ 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:289 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:301 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:309 @@ -482,9 +480,9 @@ msgstr "" #: ../../library/importlib.rst:312 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:316 @@ -506,8 +504,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:340 @@ -516,9 +514,8 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:345 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:349 @@ -576,9 +573,9 @@ msgstr "" #: ../../library/importlib.rst:377 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 "" @@ -589,16 +586,15 @@ msgstr "" #: ../../library/importlib.rst:389 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:393 msgid "" -"This ABC is deprecated in favour of supporting resource loading " -"through :class:`importlib.resources.abc.TraversableResources`. This class " -"exists for backwards compatibility only with other ABCs in this module." +"This ABC is deprecated in favour of supporting resource loading through :" +"class:`importlib.resources.abc.TraversableResources`. This class exists for " +"backwards compatibility only with other ABCs in this module." msgstr "" #: ../../library/importlib.rst:402 @@ -607,9 +603,8 @@ msgid "" "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:411 @@ -618,8 +613,8 @@ msgstr "" #: ../../library/importlib.rst:417 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:422 @@ -666,10 +661,10 @@ msgstr "" #: ../../library/importlib.rst:462 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:467 @@ -716,9 +711,9 @@ msgstr "" #: ../../library/importlib.rst:512 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:516 @@ -754,8 +749,8 @@ msgstr "" #: ../../library/importlib.rst:549 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:553 @@ -775,9 +770,9 @@ msgstr "" #: ../../library/importlib.rst:558 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 " @@ -832,9 +827,8 @@ msgstr "" #: ../../library/importlib.rst:603 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:607 @@ -864,9 +858,9 @@ msgstr "" #: ../../library/importlib.rst:633 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 "" @@ -887,9 +881,9 @@ msgstr "" #: ../../library/importlib.rst:655 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 " @@ -926,22 +920,22 @@ msgstr "" #: ../../library/importlib.rst:692 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:698 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:704 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:710 @@ -965,8 +959,8 @@ msgstr "" #: ../../library/importlib.rst:726 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:731 @@ -1005,8 +999,8 @@ msgstr "" #: ../../library/importlib.rst:769 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:774 @@ -1019,11 +1013,10 @@ msgstr "" #: ../../library/importlib.rst:783 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 "" @@ -1097,16 +1090,15 @@ 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:876 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:881 ../../library/importlib.rst:895 @@ -1118,15 +1110,14 @@ msgstr "" #: ../../library/importlib.rst:884 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:891 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:898 @@ -1157,22 +1148,21 @@ msgstr "" 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:942 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:949 @@ -1246,8 +1236,8 @@ msgstr "" #: ../../library/importlib.rst:1008 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:1014 @@ -1355,8 +1345,8 @@ msgstr "" #: ../../library/importlib.rst:1120 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:1127 @@ -1411,14 +1401,14 @@ 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:1185 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:1190 @@ -1429,12 +1419,11 @@ msgstr "" #: ../../library/importlib.rst:1195 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:1204 @@ -1461,10 +1450,9 @@ msgstr "" #: ../../library/importlib.rst:1223 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:1230 @@ -1501,29 +1489,29 @@ 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." +"is 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." msgstr "" #: ../../library/importlib.rst:1264 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:1278 @@ -1579,9 +1567,9 @@ 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:1335 @@ -1592,9 +1580,9 @@ 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:1345 @@ -1615,24 +1603,23 @@ msgstr "" #: ../../library/importlib.rst:1357 ../../library/importlib.rst:1373 #: ../../library/importlib.rst:1462 msgid "Accepts a :term:`path-like object`." -msgstr "" +msgstr "接受一個 :term:`path-like object`。" #: ../../library/importlib.rst:1363 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:1378 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:1386 @@ -1642,18 +1629,16 @@ msgstr "" #: ../../library/importlib.rst:1388 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:1393 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:1401 @@ -1714,9 +1699,9 @@ msgstr "" 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:1455 @@ -1773,16 +1758,15 @@ msgstr "" #: ../../library/importlib.rst:1502 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:1513 @@ -1797,8 +1781,8 @@ msgstr "" #: ../../library/importlib.rst:1521 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:1528 @@ -1855,8 +1839,8 @@ msgstr "" #: ../../library/importlib.rst:1560 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:1564 @@ -1886,11 +1870,11 @@ msgstr "" #: ../../library/importlib.rst:1585 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:1592 @@ -1949,6 +1933,22 @@ msgid "" ">>> lazy_typing.TYPE_CHECKING\n" "False" msgstr "" +">>> import importlib.util\n" +">>> import sys\n" +">>> def lazy_import(name):\n" +"... spec = importlib.util.find_spec(name)\n" +"... loader = importlib.util.LazyLoader(spec.loader)\n" +"... spec.loader = loader\n" +"... module = importlib.util.module_from_spec(spec)\n" +"... sys.modules[name] = module\n" +"... loader.exec_module(module)\n" +"... return module\n" +"...\n" +">>> lazy_typing = lazy_import(\"typing\")\n" +">>> # lazy_typing 是一個真實的模組物件,\n" +">>> # 但它尚未載入到記憶體中。\n" +">>> lazy_typing.TYPE_CHECKING\n" +"False" #: ../../library/importlib.rst:1639 msgid "Setting up an importer" @@ -1956,17 +1956,16 @@ msgstr "" #: ../../library/importlib.rst:1641 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:1652 diff --git a/library/importlib.resources.po b/library/importlib.resources.po index dd268a9bdb..40d502c68f 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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-" @@ -37,18 +37,19 @@ msgid "" "\"Resources\" are file-like resources associated with a module or package in " "Python. The resources may be contained directly in a package, within a " "subdirectory contained in that package, or adjacent to modules outside a " -"package. Resources may be text or binary. As a result, Python module sources " -"(.py) of a package and compilation artifacts (pycache) are technically de-" -"facto resources of that package. In practice, however, resources are " -"primarily those non-Python artifacts exposed specifically by the package " -"author." +"package. Resources may be text or binary. As a result, a package's Python " +"module sources (.py), compilation artifacts (pycache), and installation " +"artifacts (like :func:`reserved filenames ` in " +"directories) are technically de-facto resources of that package. In " +"practice, however, resources are primarily those non-Python artifacts " +"exposed specifically by the package author." msgstr "" -#: ../../library/importlib.resources.rst:25 +#: ../../library/importlib.resources.rst:26 msgid "Resources can be opened or read in either binary or text mode." msgstr "" -#: ../../library/importlib.resources.rst:27 +#: ../../library/importlib.resources.rst:28 msgid "" "Resources are roughly akin to files inside directories, though it's " "important to keep in mind that this is just a metaphor. Resources and " @@ -57,7 +58,7 @@ msgid "" "zip file using :py:mod:`zipimport`." msgstr "" -#: ../../library/importlib.resources.rst:35 +#: ../../library/importlib.resources.rst:36 msgid "" "This module provides functionality similar to `pkg_resources `_ `Basic Resource " @@ -67,7 +68,7 @@ msgid "" "consistent semantics." msgstr "" -#: ../../library/importlib.resources.rst:43 +#: ../../library/importlib.resources.rst:44 msgid "" "The standalone backport of this module provides more information on `using " "importlib.resources `_." msgstr "" -#: ../../library/importlib.resources.rst:49 +#: ../../library/importlib.resources.rst:50 msgid "" ":class:`Loaders ` that wish to support resource " "reading should implement a ``get_resource_reader(fullname)`` method as " "specified by :class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.resources.rst:55 +#: ../../library/importlib.resources.rst:56 msgid "" -"Represents an anchor for resources, either a :class:`module object " -"` or a module name as a string. Defined as ``Union[str, " +"Represents an anchor for resources, either a :class:`module object ` or a module name as a string. Defined as ``Union[str, " "ModuleType]``." msgstr "" -#: ../../library/importlib.resources.rst:61 +#: ../../library/importlib.resources.rst:62 msgid "" "Returns a :class:`~importlib.resources.abc.Traversable` object representing " "the resource container (think directory) and its resources (think files). A " "Traversable may contain other containers (think subdirectories)." msgstr "" -#: ../../library/importlib.resources.rst:66 +#: ../../library/importlib.resources.rst:67 msgid "" "*anchor* is an optional :class:`Anchor`. If the anchor is a package, " "resources are resolved from that package. If a module, resources are " @@ -104,17 +105,16 @@ msgid "" "If the anchor is omitted, the caller's module is used." msgstr "" -#: ../../library/importlib.resources.rst:74 +#: ../../library/importlib.resources.rst:75 msgid "" "*package* parameter was renamed to *anchor*. *anchor* can now be a non-" "package module and if omitted will default to the caller's module. *package* " -"is still accepted for compatibility but will raise " -"a :exc:`DeprecationWarning`. Consider passing the anchor positionally or " -"using ``importlib_resources >= 5.10`` for a compatible interface on older " -"Pythons." +"is still accepted for compatibility but will raise a :exc:" +"`DeprecationWarning`. Consider passing the anchor positionally or using " +"``importlib_resources >= 5.10`` for a compatible interface on older Pythons." msgstr "" -#: ../../library/importlib.resources.rst:84 +#: ../../library/importlib.resources.rst:85 msgid "" "Given a :class:`~importlib.resources.abc.Traversable` object representing a " "file or directory, typically from :func:`importlib.resources.files`, return " @@ -122,61 +122,60 @@ msgid "" "manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:89 +#: ../../library/importlib.resources.rst:90 msgid "" "Exiting the context manager cleans up any temporary file or directory " "created when the resource was extracted from e.g. a zip file." msgstr "" -#: ../../library/importlib.resources.rst:92 +#: ../../library/importlib.resources.rst:93 msgid "" "Use ``as_file`` when the Traversable methods (``read_text``, etc) are " "insufficient and an actual file or directory on the file system is required." msgstr "" -#: ../../library/importlib.resources.rst:98 +#: ../../library/importlib.resources.rst:99 msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:105 +#: ../../library/importlib.resources.rst:106 msgid "Functional API" msgstr "" -#: ../../library/importlib.resources.rst:107 +#: ../../library/importlib.resources.rst:108 msgid "" "A set of simplified, backwards-compatible helpers is available. These allow " "common operations in a single function call." msgstr "" -#: ../../library/importlib.resources.rst:110 +#: ../../library/importlib.resources.rst:111 msgid "For all the following functions:" msgstr "" -#: ../../library/importlib.resources.rst:112 +#: ../../library/importlib.resources.rst:113 msgid "" -"*anchor* is an :class:`~importlib.resources.Anchor`, as " -"in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be " -"omitted." +"*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." +"resources.files`. Unlike in ``files``, it may not be omitted." msgstr "" -#: ../../library/importlib.resources.rst:116 +#: ../../library/importlib.resources.rst:117 msgid "" "*path_names* are components of a resource's path name, relative to the " "anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:120 +#: ../../library/importlib.resources.rst:121 msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "importlib.resources.read_text(my_module, \"info.txt\")" -#: ../../library/importlib.resources.rst:122 +#: ../../library/importlib.resources.rst:123 msgid "" "Like :meth:`Traversable.joinpath `, The " "individual components should use forward slashes (``/``) as path separators. " "For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:127 +#: ../../library/importlib.resources.rst:128 msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" @@ -184,14 +183,14 @@ msgstr "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" -#: ../../library/importlib.resources.rst:130 +#: ../../library/importlib.resources.rst:131 msgid "" "For backward compatibility reasons, functions that read text require an " "explicit *encoding* argument if multiple *path_names* are given. For " "example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:134 +#: ../../library/importlib.resources.rst:135 msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" @@ -199,124 +198,124 @@ msgstr "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" -#: ../../library/importlib.resources.rst:139 +#: ../../library/importlib.resources.rst:140 msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:141 -#: ../../library/importlib.resources.rst:184 -#: ../../library/importlib.resources.rst:232 -#: ../../library/importlib.resources.rst:249 -#: ../../library/importlib.resources.rst:267 +#: ../../library/importlib.resources.rst:142 +#: ../../library/importlib.resources.rst:185 +#: ../../library/importlib.resources.rst:233 +#: ../../library/importlib.resources.rst:250 +#: ../../library/importlib.resources.rst:268 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." msgstr "" -#: ../../library/importlib.resources.rst:144 +#: ../../library/importlib.resources.rst:145 msgid "" "This function returns a :class:`~typing.BinaryIO` object, that is, a binary " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:147 -#: ../../library/importlib.resources.rst:171 -#: ../../library/importlib.resources.rst:187 -#: ../../library/importlib.resources.rst:208 -#: ../../library/importlib.resources.rst:235 -#: ../../library/importlib.resources.rst:252 -#: ../../library/importlib.resources.rst:270 +#: ../../library/importlib.resources.rst:148 +#: ../../library/importlib.resources.rst:172 +#: ../../library/importlib.resources.rst:188 +#: ../../library/importlib.resources.rst:209 +#: ../../library/importlib.resources.rst:236 +#: ../../library/importlib.resources.rst:253 +#: ../../library/importlib.resources.rst:271 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" -#: ../../library/importlib.resources.rst:149 +#: ../../library/importlib.resources.rst:150 msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(anchor).joinpath(*path_names).open('rb')" -#: ../../library/importlib.resources.rst:151 -#: ../../library/importlib.resources.rst:191 -#: ../../library/importlib.resources.rst:256 +#: ../../library/importlib.resources.rst:152 +#: ../../library/importlib.resources.rst:192 +#: ../../library/importlib.resources.rst:257 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" -#: ../../library/importlib.resources.rst:157 +#: ../../library/importlib.resources.rst:158 msgid "" "Open the named resource for text reading. By default, the contents are read " "as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:160 -#: ../../library/importlib.resources.rst:200 +#: ../../library/importlib.resources.rst:161 +#: ../../library/importlib.resources.rst:201 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " "in built-in :func:`open`." msgstr "" -#: ../../library/importlib.resources.rst:164 -#: ../../library/importlib.resources.rst:204 +#: ../../library/importlib.resources.rst:165 +#: ../../library/importlib.resources.rst:205 msgid "" "For backward compatibility reasons, the *encoding* argument must be given " "explicitly if there are multiple *path_names*. This limitation is scheduled " "to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:168 +#: ../../library/importlib.resources.rst:169 msgid "" "This function returns a :class:`~typing.TextIO` object, that is, a text " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:173 +#: ../../library/importlib.resources.rst:174 msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:175 -#: ../../library/importlib.resources.rst:212 -#: ../../library/importlib.resources.rst:239 +#: ../../library/importlib.resources.rst:176 +#: ../../library/importlib.resources.rst:213 +#: ../../library/importlib.resources.rst:240 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:182 +#: ../../library/importlib.resources.rst:183 msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "以 :class:`bytes` 形式讀取並回傳指定資源的內容。" -#: ../../library/importlib.resources.rst:189 +#: ../../library/importlib.resources.rst:190 msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(anchor).joinpath(*path_names).read_bytes()" -#: ../../library/importlib.resources.rst:197 +#: ../../library/importlib.resources.rst:198 msgid "" "Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:210 +#: ../../library/importlib.resources.rst:211 msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:219 +#: ../../library/importlib.resources.rst:220 msgid "" "Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:223 +#: ../../library/importlib.resources.rst:224 msgid "" "Exiting the context manager cleans up any temporary files created, e.g. when " "the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:226 +#: ../../library/importlib.resources.rst:227 msgid "" "For example, the :meth:`~pathlib.Path.stat` method requires an actual file " "system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:229 +#: ../../library/importlib.resources.rst:230 msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" @@ -324,21 +323,21 @@ msgstr "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" -#: ../../library/importlib.resources.rst:237 +#: ../../library/importlib.resources.rst:238 msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:246 +#: ../../library/importlib.resources.rst:247 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:254 +#: ../../library/importlib.resources.rst:255 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:262 +#: ../../library/importlib.resources.rst:263 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -346,7 +345,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:272 +#: ../../library/importlib.resources.rst:273 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -354,7 +353,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:275 +#: ../../library/importlib.resources.rst:276 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." diff --git a/library/inspect.po b/library/inspect.po index 093377a4d2..4d6134d298 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -850,6 +850,11 @@ msgid "" ">>> inspect.isasyncgenfunction(agen)\n" "True" msgstr "" +">>> async def agen():\n" +"... yield 1\n" +"...\n" +">>> inspect.isasyncgenfunction(agen)\n" +"True" #: ../../library/inspect.rst:503 msgid "" @@ -1643,11 +1648,11 @@ msgstr "" #: ../../library/inspect.rst:1125 msgid ":pep:`362` - Function Signature Object." -msgstr "" +msgstr ":pep:`362` - 函式簽名物件。" #: ../../library/inspect.rst:1126 msgid "The detailed specification, implementation details and examples." -msgstr "" +msgstr "詳細的規格、實作細節和範例。" #: ../../library/inspect.rst:1132 msgid "Classes and functions" @@ -1675,6 +1680,8 @@ msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" +"``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " +"annotations)``" #: ../../library/inspect.rst:1153 msgid "" diff --git a/library/ipaddress.po b/library/ipaddress.po index 26ac4a2252..055f7119c0 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -264,11 +264,11 @@ msgstr "" #: ../../library/ipaddress.rst:209 msgid "``64:ff9b:1::/48`` is considered private." -msgstr "" +msgstr "``64:ff9b:1::/48`` 被視為私有。" #: ../../library/ipaddress.rst:210 msgid "``2002::/16`` is considered private." -msgstr "" +msgstr "``2002::/16`` 被視為私有。" #: ../../library/ipaddress.rst:211 msgid "" diff --git a/library/json.po b/library/json.po index 98996caed7..76ddc68384 100644 --- a/library/json.po +++ b/library/json.po @@ -118,6 +118,9 @@ msgid "" ">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" "'[1,2,3,{\"4\":5,\"6\":7}]'" msgstr "" +">>> import json\n" +">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" +"'[1,2,3,{\"4\":5,\"6\":7}]'" #: ../../library/json.rst:59 msgid "Pretty printing::" @@ -1161,10 +1164,13 @@ msgid "" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" +">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" +">>> json.loads(weird_json)\n" +"{'x': 3}" #: ../../library/json.rst:694 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." -msgstr "*object_parts_hook* 參數可以改變這個行為。" +msgstr "*object_pairs_hook* 參數可以改變這個行為。" #: ../../library/json.rst:698 msgid "Top-level Non-Object, Non-Array Values" diff --git a/library/logging.config.po b/library/logging.config.po index 29d54ac575..06dbdf1241 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -373,11 +373,11 @@ msgstr "``style``" #: ../../library/logging.config.rst:263 msgid "``validate`` (since version >=3.8)" -msgstr "" +msgstr "``validate`` (自 3.8 版起)" #: ../../library/logging.config.rst:264 msgid "``defaults`` (since version >=3.12)" -msgstr "" +msgstr "``defaults`` (自 3.12 版起)" #: ../../library/logging.config.rst:266 msgid "" diff --git a/library/mailbox.po b/library/mailbox.po index 2a44b786f7..44305a8f18 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -1081,7 +1081,7 @@ msgstr "" #: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 #: ../../library/mailbox.rst:1502 msgid "Flag" -msgstr "" +msgstr "旗標" #: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 #: ../../library/mailbox.rst:1502 @@ -1092,7 +1092,7 @@ msgstr "含義" #: ../../library/mailbox.rst:1282 ../../library/mailbox.rst:1369 #: ../../library/mailbox.rst:1502 msgid "Explanation" -msgstr "" +msgstr "解釋" #: ../../library/mailbox.rst:966 ../../library/mailbox.rst:1137 #: ../../library/mailbox.rst:1508 @@ -1101,11 +1101,11 @@ msgstr "D" #: ../../library/mailbox.rst:966 msgid "Draft" -msgstr "" +msgstr "草稿" #: ../../library/mailbox.rst:966 msgid "Under composition" -msgstr "" +msgstr "編輯中" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1510 @@ -1115,12 +1115,12 @@ msgstr "F" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1510 msgid "Flagged" -msgstr "" +msgstr "已標記" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1288 ../../library/mailbox.rst:1510 msgid "Marked as important" -msgstr "" +msgstr "標記為重要" #: ../../library/mailbox.rst:970 msgid "P" @@ -1141,7 +1141,7 @@ msgstr "R" #: ../../library/mailbox.rst:972 msgid "Replied" -msgstr "" +msgstr "已回覆" #: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1141 #: ../../library/mailbox.rst:1286 ../../library/mailbox.rst:1377 @@ -1155,7 +1155,7 @@ msgstr "S" #: ../../library/mailbox.rst:974 msgid "Seen" -msgstr "" +msgstr "已查看" #: ../../library/mailbox.rst:974 ../../library/mailbox.rst:1133 #: ../../library/mailbox.rst:1504 @@ -1177,7 +1177,7 @@ msgstr "" #: ../../library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!MaildirMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:984 msgid "" @@ -1274,13 +1274,13 @@ msgstr "" #: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1332 #: ../../library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" -msgstr "" +msgstr ":class:`mboxMessage` 或 :class:`MMDFMessage` 狀態" #: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1082 #: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1206 #: ../../library/mailbox.rst:1578 msgid "\"cur\" subdirectory" -msgstr "" +msgstr "\"cur\" 子目錄" #: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1206 #: ../../library/mailbox.rst:1223 ../../library/mailbox.rst:1238 @@ -1288,7 +1288,7 @@ msgstr "" #: ../../library/mailbox.rst:1595 ../../library/mailbox.rst:1610 #: ../../library/mailbox.rst:1626 msgid "O flag" -msgstr "" +msgstr "O 旗標" #: ../../library/mailbox.rst:1067 ../../library/mailbox.rst:1086 #: ../../library/mailbox.rst:1210 ../../library/mailbox.rst:1225 @@ -1296,7 +1296,7 @@ msgstr "" #: ../../library/mailbox.rst:1339 ../../library/mailbox.rst:1582 #: ../../library/mailbox.rst:1597 ../../library/mailbox.rst:1630 msgid "F flag" -msgstr "" +msgstr "F 旗標" #: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1071 #: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1103 @@ -1305,7 +1305,7 @@ msgstr "" #: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1576 #: ../../library/mailbox.rst:1584 ../../library/mailbox.rst:1624 msgid "R flag" -msgstr "" +msgstr "R 旗標" #: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1212 #: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1242 @@ -1314,25 +1314,25 @@ msgstr "" #: ../../library/mailbox.rst:1599 ../../library/mailbox.rst:1614 #: ../../library/mailbox.rst:1632 msgid "A flag" -msgstr "" +msgstr "A 旗標" #: ../../library/mailbox.rst:1071 ../../library/mailbox.rst:1204 #: ../../library/mailbox.rst:1576 msgid "S flag" -msgstr "" +msgstr "S 旗標" #: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1105 #: ../../library/mailbox.rst:1208 ../../library/mailbox.rst:1447 #: ../../library/mailbox.rst:1580 msgid "T flag" -msgstr "" +msgstr "T 旗標" #: ../../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 "" +msgstr "D 旗標" #: ../../library/mailbox.rst:1076 msgid "" @@ -1343,36 +1343,36 @@ msgstr "" #: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1219 #: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1591 msgid ":class:`MHMessage` state" -msgstr "" +msgstr ":class:`MHMessage` 狀態" #: ../../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 "" +msgstr "\"unseen\" 序列" #: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" -msgstr "" +msgstr "\"cur\" 子目錄和 S 旗標" #: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1221 #: ../../library/mailbox.rst:1593 msgid "no \"unseen\" sequence" -msgstr "" +msgstr "沒有 \"unseen\" 序列" #: ../../library/mailbox.rst:1086 ../../library/mailbox.rst:1225 #: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1339 #: ../../library/mailbox.rst:1597 msgid "\"flagged\" sequence" -msgstr "" +msgstr "\"flagged\" 序列" #: ../../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 "" +msgstr "\"replied\" 序列" #: ../../library/mailbox.rst:1091 msgid "" @@ -1383,40 +1383,40 @@ msgstr "" #: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1234 #: ../../library/mailbox.rst:1346 ../../library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" -msgstr "" +msgstr ":class:`BabylMessage` 狀態" #: ../../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 "" +msgstr "\"unseen\" 標籤" #: ../../library/mailbox.rst:1099 ../../library/mailbox.rst:1236 #: ../../library/mailbox.rst:1608 msgid "no \"unseen\" label" -msgstr "" +msgstr "沒有 \"unseen\" 標籤" #: ../../library/mailbox.rst:1101 ../../library/mailbox.rst:1451 msgid "P flag" -msgstr "" +msgstr "P 旗標" #: ../../library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" -msgstr "" +msgstr "\"forwarded\" 或 \"resent\" 標籤" #: ../../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 "" +msgstr "\"answered\" 標籤" #: ../../library/mailbox.rst:1105 ../../library/mailbox.rst:1240 #: ../../library/mailbox.rst:1447 ../../library/mailbox.rst:1465 #: ../../library/mailbox.rst:1612 msgid "\"deleted\" label" -msgstr "" +msgstr "\"deleted\" 標籤" #: ../../library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" @@ -1476,7 +1476,7 @@ msgstr "" #: ../../library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!mboxMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" @@ -1535,7 +1535,7 @@ msgstr "" #: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1317 #: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" -msgstr "" +msgstr ":class:`MaildirMessage` 狀態" #: ../../library/mailbox.rst:1215 msgid "" @@ -1546,7 +1546,7 @@ msgstr "" #: ../../library/mailbox.rst:1221 ../../library/mailbox.rst:1236 #: ../../library/mailbox.rst:1593 ../../library/mailbox.rst:1608 msgid "R flag and O flag" -msgstr "" +msgstr "R 旗標和 O 旗標" #: ../../library/mailbox.rst:1230 msgid "" @@ -1563,7 +1563,7 @@ msgstr "" #: ../../library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" -msgstr "" +msgstr ":class:`MMDFMessage` 狀態" #: ../../library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" @@ -1606,7 +1606,7 @@ msgstr "" #: ../../library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!MHMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." @@ -1632,7 +1632,7 @@ msgstr "" #: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1445 msgid "no S flag" -msgstr "" +msgstr "無 S 旗標" #: ../../library/mailbox.rst:1326 msgid "" @@ -1644,7 +1644,7 @@ msgstr "" #: ../../library/mailbox.rst:1335 ../../library/mailbox.rst:1463 msgid "no R flag" -msgstr "" +msgstr "無 R 旗標" #: ../../library/mailbox.rst:1342 msgid "" @@ -1721,7 +1721,7 @@ msgstr "" #: ../../library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!BabylMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1395 msgid "Return a list of labels on the message." @@ -1774,7 +1774,7 @@ msgstr "" #: ../../library/mailbox.rst:1451 msgid "\"forwarded\" label" -msgstr "" +msgstr "\"forwarded\" 標籤" #: ../../library/mailbox.rst:1454 msgid "" @@ -1849,7 +1849,7 @@ msgstr "" #: ../../library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" -msgstr "" +msgstr ":class:`mboxMessage` 狀態" #: ../../library/mailbox.rst:1637 msgid "Exceptions" diff --git a/library/mimetypes.po b/library/mimetypes.po index 7a4af89faa..ca02fe441f 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -376,7 +376,7 @@ msgstr "" #: ../../library/mimetypes.rst:320 msgid "Command-line usage" -msgstr "" +msgstr "命令列用法" #: ../../library/mimetypes.rst:322 msgid "" @@ -386,7 +386,7 @@ msgstr "" #: ../../library/mimetypes.rst:324 msgid "python -m mimetypes [-h] [-e] [-l] type [type ...]" -msgstr "" +msgstr "python -m mimetypes [-h] [-e] [-l] type [type ...]" #: ../../library/mimetypes.rst:328 msgid "The following options are accepted:" diff --git a/library/mmap.po b/library/mmap.po index be083b8ab9..6349191087 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-09-22 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -289,7 +289,7 @@ msgstr "" #: ../../library/mmap.rst:187 msgid "``True`` if the file is closed." -msgstr "" +msgstr "若檔案已關閉則回傳 ``True``。" #: ../../library/mmap.rst:194 msgid "" @@ -299,12 +299,12 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:199 ../../library/mmap.rst:291 -#: ../../library/mmap.rst:331 +#: ../../library/mmap.rst:199 ../../library/mmap.rst:292 +#: ../../library/mmap.rst:332 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/mmap.rst:205 +#: ../../library/mmap.rst:206 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -314,20 +314,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:212 +#: ../../library/mmap.rst:213 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: ../../library/mmap.rst:215 +#: ../../library/mmap.rst:216 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: ../../library/mmap.rst:223 +#: ../../library/mmap.rst:224 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -336,18 +336,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: ../../library/mmap.rst:230 +#: ../../library/mmap.rst:231 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: ../../library/mmap.rst:237 +#: ../../library/mmap.rst:238 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:244 +#: ../../library/mmap.rst:245 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -355,28 +355,28 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: ../../library/mmap.rst:250 +#: ../../library/mmap.rst:251 msgid "Argument can be omitted or ``None``." msgstr "" -#: ../../library/mmap.rst:255 +#: ../../library/mmap.rst:256 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: ../../library/mmap.rst:261 +#: ../../library/mmap.rst:262 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: ../../library/mmap.rst:268 +#: ../../library/mmap.rst:269 msgid "Resizes the map and the underlying file, if any." msgstr "" -#: ../../library/mmap.rst:270 +#: ../../library/mmap.rst:271 msgid "" "Resizing a map created with *access* of :const:`ACCESS_READ` or :const:" "`ACCESS_COPY`, will raise a :exc:`TypeError` exception. Resizing a map " @@ -384,7 +384,7 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:275 +#: ../../library/mmap.rst:276 msgid "" "**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " "other maps against the same named file. Resizing an anonymous map (ie " @@ -392,13 +392,13 @@ msgid "" "copied over up to the length of the new size." msgstr "" -#: ../../library/mmap.rst:280 +#: ../../library/mmap.rst:281 msgid "" "Correctly fails if attempting to resize when another map is held Allows " "resize against an anonymous map on Windows" msgstr "" -#: ../../library/mmap.rst:286 +#: ../../library/mmap.rst:287 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -406,7 +406,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:297 +#: ../../library/mmap.rst:298 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -414,27 +414,27 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: ../../library/mmap.rst:302 +#: ../../library/mmap.rst:303 msgid "Return the new absolute position instead of ``None``." msgstr "" -#: ../../library/mmap.rst:307 +#: ../../library/mmap.rst:308 msgid "" "Return whether the file supports seeking, and the return value is always " "``True``." msgstr "" -#: ../../library/mmap.rst:313 +#: ../../library/mmap.rst:314 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: ../../library/mmap.rst:319 +#: ../../library/mmap.rst:320 msgid "Returns the current position of the file pointer." msgstr "" -#: ../../library/mmap.rst:324 +#: ../../library/mmap.rst:325 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -444,11 +444,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:334 +#: ../../library/mmap.rst:335 msgid "The number of bytes written is now returned." msgstr "" -#: ../../library/mmap.rst:340 +#: ../../library/mmap.rst:341 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -456,25 +456,25 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:348 +#: ../../library/mmap.rst:349 msgid "MADV_* Constants" msgstr "MADV_* 常數" -#: ../../library/mmap.rst:375 +#: ../../library/mmap.rst:376 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: ../../library/mmap.rst:378 +#: ../../library/mmap.rst:379 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: ../../library/mmap.rst:385 +#: ../../library/mmap.rst:386 msgid "MAP_* Constants" msgstr "MAP_* 常數" -#: ../../library/mmap.rst:409 +#: ../../library/mmap.rst:410 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. :data:" "`MAP_ALIGNED_SUPER` is only available at FreeBSD and :data:`MAP_CONCEAL` is " @@ -482,19 +482,19 @@ msgid "" "some systems." msgstr "" -#: ../../library/mmap.rst:413 +#: ../../library/mmap.rst:414 msgid "Added :data:`MAP_POPULATE` constant." msgstr "新增 :data:`MAP_POPULATE` 常數。" -#: ../../library/mmap.rst:416 +#: ../../library/mmap.rst:417 msgid "Added :data:`MAP_STACK` constant." msgstr "新增 :data:`MAP_STACK` 常數。" -#: ../../library/mmap.rst:419 +#: ../../library/mmap.rst:420 msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." msgstr "新增 :data:`MAP_ALIGNED_SUPER` 和 :data:`MAP_CONCEAL` 常數。" -#: ../../library/mmap.rst:422 +#: ../../library/mmap.rst:423 msgid "" "Added :data:`MAP_32BIT`, :data:`MAP_HASSEMAPHORE`, :data:`MAP_JIT`, :data:" "`MAP_NOCACHE`, :data:`MAP_NOEXTEND`, :data:`MAP_NORESERVE`, :data:" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 15f6ddc703..b5178aa2ad 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -2982,7 +2982,7 @@ msgstr "" #: ../../library/multiprocessing.rst:2036 msgid ":class:`set` support was added." -msgstr "" +msgstr "已新增對 :class:`set` 的支援。" #: ../../library/multiprocessing.rst:2039 msgid "" diff --git a/library/numbers.po b/library/numbers.po index 9715ceb1a0..4296545206 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+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-" @@ -30,10 +30,10 @@ msgstr "**原始碼:**\\ :source:`Lib/numbers.py`" #: ../../library/numbers.rst:11 msgid "" -"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of " -"numeric :term:`abstract base classes ` which " -"progressively define more operations. None of the types defined in this " -"module are intended to be instantiated." +"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of numeric :" +"term:`abstract base classes ` which progressively " +"define more operations. None of the types defined in this module are " +"intended to be instantiated." msgstr "" ":mod:`!numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 " "` 的階層結構,其中逐一定義了更多操作。此模組中定義的型別" @@ -54,16 +54,15 @@ msgstr "數值的階層" #: ../../library/numbers.rst:27 msgid "" "Subclasses of this type describe complex numbers and include the operations " -"that work on the built-in :class:`complex` type. These are: conversions " -"to :class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, " -"``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" +"that work on the built-in :class:`complex` type. These are: conversions to :" +"class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, ``-" +"``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" "=``. All except ``-`` and ``!=`` are abstract." msgstr "" "這個型別的子類別描述了複數並包含適用於內建 :class:`complex` 型別的操作。這些" -"操作有::class:`complex` 和 :class:`bool` 的轉" -"換、:attr:`.real`、:attr:`.imag`、``+``、``-``、``*``、``/``、" -"``**``、:func:`abs`、:meth:`conjugate`、``==`` 以及 ``!=``。除 ``-`` 和 ``!" -"=`` 之外所有操作都是抽象的。" +"操作有::class:`complex` 和 :class:`bool` 的轉換、:attr:`.real`、:attr:`." +"imag`、``+``、``-``、``*``、``/``、``**``、:func:`abs`、:meth:`conjugate`、" +"``==`` 以及 ``!=``。除 ``-`` 和 ``!=`` 之外所有操作都是抽象的。" #: ../../library/numbers.rst:35 msgid "Abstract. Retrieves the real component of this number." @@ -87,59 +86,59 @@ msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能 #: ../../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`, " -"``//``, ``%``, ``<``, ``<=``, ``>``, and ``>=``." +"In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" +"func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " +"``%``, ``<``, ``<=``, ``>``, and ``>=``." msgstr "" -"簡單的說,有 :class:`float` 的轉" -"換、:func:`math.trunc`、:func:`round`、:func:`math.floor`、:func:`math.ceil`、:func:`divmod`、" -"``//``、``%``、 ``<``、``<=``、``>``、和 ``>=``。" +"簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:" +"`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" +"``<=``、``>``、和 ``>=``。" #: ../../library/numbers.rst:56 msgid "" -"Real also provides defaults " -"for :func:`complex`, :attr:`~Complex.real`, :attr:`~Complex.imag`, " -"and :meth:`~Complex.conjugate`." +"Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" +"attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" #: ../../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:`float`." +"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" +"`~Rational.denominator` properties. It also provides a default for :func:" +"`float`." msgstr "" -":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` " -"和 :attr:`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設" -"值。" +":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" +"`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" #: ../../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 :attr:`~Rational.denominator` positive." +"should be instances of :class:`Integral` and should be in lowest terms with :" +"attr:`~Rational.denominator` positive." msgstr "" -":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須" -"是 :class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" +":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" +"class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 -msgid "Abstract." -msgstr "為抽象的。" +#: ../../library/numbers.rst:72 +msgid "Abstract. The numerator of this rational number." +msgstr "為抽象的。該有理數的分子。" + +#: ../../library/numbers.rst:76 +msgid "Abstract. The denominator of this rational number." +msgstr "為抽象的。該有理數的分母。" #: ../../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:`~Rational.denominator`. Adds abstract methods for :func:`pow` " -"with modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, " -"``~``." +"defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" +"`~Rational.denominator`. Adds abstract methods for :func:`pow` with modulus " +"and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." msgstr "" -":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。" -"為 :func:`float`、:attr:`~Rational.numerator` " -"和 :attr:`~Rational.denominator` 提供了預設值。為 :func:`pow` 方法增加了求餘 " -"(modulus) 和位元字串運算 (bit-string operations) 的抽象方法:``<<``、``>>``、" -"``&``、``^``、``|``、``~``。" +":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。為 :func:" +"`float`、:attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 提供了" +"預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " +"operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" #: ../../library/numbers.rst:89 msgid "Notes for type implementers" @@ -149,12 +148,12 @@ msgstr "給型別實作者的註記" 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 " -"the real numbers. For example, :class:`fractions.Fraction` " -"implements :func:`hash` as follows::" +"the real numbers. For example, :class:`fractions.Fraction` implements :func:" +"`hash` as follows::" msgstr "" "實作者需注意,相等的數值除了大小相等外,還必須擁有同樣的雜湊值。當使用兩個不" -"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下" -"的 :func:`hash` 實作如下: ::" +"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" +"func:`hash` 實作如下: ::" #: ../../library/numbers.rst:96 msgid "" @@ -191,8 +190,8 @@ msgid "" "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" -"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以" -"在 :class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" +"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" +"class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" #: ../../library/numbers.rst:117 msgid "" @@ -211,9 +210,8 @@ 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 " "arguments, or convert both to the nearest built in type and do the operation " -"there. For subtypes of :class:`Integral`, this means " -"that :meth:`~object.__add__` and :meth:`~object.__radd__` should be defined " -"as::" +"there. For subtypes of :class:`Integral`, this means that :meth:`~object." +"__add__` and :meth:`~object.__radd__` should be defined as::" msgstr "" "我們想要實作算術操作,來使得混合模式操作要麼呼叫一個作者知道兩個引數之型別的" "實作,要麼將其轉換成最接近的內建型別並執行這個操作。對於 :class:`Integral` 的" @@ -272,10 +270,10 @@ msgstr "" #: ../../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 ``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will " -"be an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " +"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 " +"``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will be " +"an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" ":class:`Complex` 的子類別有 5 種不同的混合型別操作。我將上面提到所有不涉及 " @@ -293,9 +291,9 @@ msgstr "" 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 " -"more intelligent :meth:`~object.__radd__`, so the boilerplate should " -"return :data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not " -"implement :meth:`!__add__` at all.)" +"more intelligent :meth:`~object.__radd__`, so the boilerplate should return :" +"data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not implement :" +"meth:`!__add__` at all.)" msgstr "" "如果 ``A`` 回退成模板程式碼,它將回傳一個來自 :meth:`~object.__add__` 的值," "並喪失讓 ``B`` 定義一個更完善的 :meth:`~object.__radd__` 的機會,因此模板需要" @@ -330,24 +328,24 @@ msgstr "" #: ../../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 :class:`complex`, and both :meth:`~object.__radd__` s land there, so " -"``a+b == b+a``." +"then the appropriate shared operation is the one involving the built in :" +"class:`complex`, and both :meth:`~object.__radd__` s land there, so ``a+b == " +"b+a``." msgstr "" "如果 ``A <: Complex`` 和 ``B <: Real`` 且沒有共享任何其他型別上的理解,那麼適" -"當的共享操作會涉及內建的 :class:`complex`,並且分別用" -"到 :meth:`~object.__radd__`,因此 ``a+b == b+a``。" +"當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." +"__radd__`,因此 ``a+b == b+a``。" #: ../../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 " -"reverse instances of any given operator. For " -"example, :class:`fractions.Fraction` uses::" +"reverse instances of any given operator. For example, :class:`fractions." +"Fraction` uses::" msgstr "" "由於大部分對任意給定類型的操作都十分相似的,定義一個為任意給定運算子生成向前 " -"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例" -"如,:class:`fractions.Fraction` 使用了: ::" +"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" +"`fractions.Fraction` 使用了: ::" #: ../../library/numbers.rst:193 msgid "" @@ -426,9 +424,3 @@ msgstr "" "__add__, __radd__ = _operator_fallbacks(_add, operator.add)\n" "\n" "# ..." - -#~ msgid "Abstract. The numerator of this rational number." -#~ msgstr "為抽象的。該有理數的分子。" - -#~ msgid "Abstract. The denominator of this rational number." -#~ msgstr "為抽象的。該有理數的分母。" diff --git a/library/optparse.po b/library/optparse.po index 42e4ab6d59..220f935226 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1581,7 +1581,7 @@ msgstr "" #: ../../library/optparse.rst:912 msgid "Creating the parser" -msgstr "" +msgstr "建立剖析器" #: ../../library/optparse.rst:914 msgid "" @@ -1624,11 +1624,11 @@ msgstr "" #: ../../library/optparse.rst:936 msgid "``option_class`` (default: optparse.Option)" -msgstr "" +msgstr "``option_class``\\ (預設值:optparse.Option)" #: ../../library/optparse.rst:937 msgid "Class to use when adding options to the parser in :meth:`add_option`." -msgstr "" +msgstr "在 :meth:`add_option` 中新增選項時要使用的類別。" #: ../../library/optparse.rst:939 msgid "``version`` (default: ``None``)" @@ -2049,7 +2049,7 @@ msgstr "" #: ../../library/optparse.rst:1206 msgid "Standard option actions" -msgstr "" +msgstr "標準選項動作" #: ../../library/optparse.rst:1208 msgid "" @@ -2083,7 +2083,7 @@ msgstr "" #: ../../library/optparse.rst:1226 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." -msgstr "" +msgstr "如果沒有提供 :attr:`~Option.type`,它的預設值是 ``\"string\"``。" #: ../../library/optparse.rst:1228 msgid "" @@ -2117,7 +2117,7 @@ msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" #: ../../library/optparse.rst:1242 msgid ":mod:`optparse` will set ::" -msgstr "" +msgstr ":mod:`optparse` 將會設定: ::" #: ../../library/optparse.rst:1244 msgid "" @@ -2668,7 +2668,7 @@ msgstr "" #: ../../library/optparse.rst:1569 msgid "``\"error\"`` (default)" -msgstr "" +msgstr "``\"error\"`` (預設值)" #: ../../library/optparse.rst:1570 msgid "" diff --git a/library/os.po b/library/os.po index a882bc46b5..4b37ac7df9 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-09-22 00:18+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-" @@ -512,7 +512,7 @@ msgstr "" #: ../../library/os.rst:281 msgid ":func:`fsdecode` is the reverse function." -msgstr "" +msgstr ":func:`fsdecode` 是反函式。" #: ../../library/os.rst:285 ../../library/os.rst:300 msgid "" @@ -528,7 +528,7 @@ msgstr "" #: ../../library/os.rst:296 msgid ":func:`fsencode` is the reverse function." -msgstr "" +msgstr ":func:`fsencode` 是反函式。" #: ../../library/os.rst:307 msgid "Return the file system representation of the path." @@ -2183,9 +2183,8 @@ msgid "" "functions in the :mod:`os` module must be a string specifying a file path. " "However, some functions now alternatively accept an open file descriptor for " "their *path* argument. The function will then operate on the file referred " -"to by the descriptor. (For POSIX systems, Python will call the variant of " -"the function prefixed with ``f`` (e.g. call ``fchdir`` instead of " -"``chdir``).)" +"to by the descriptor. For POSIX systems, Python will call the variant of the " +"function prefixed with ``f`` (e.g. call ``fchdir`` instead of ``chdir``)." msgstr "" #: ../../library/os.rst:2015 @@ -2207,7 +2206,7 @@ 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 " "operate on should be relative; path will then be relative to that " -"directory. If the path is absolute, *dir_fd* is ignored. (For POSIX " +"directory. If the path is absolute, *dir_fd* is ignored. For POSIX " "systems, Python will call the variant of the function with an ``at`` suffix " "and possibly prefixed with ``f`` (e.g. call ``faccessat`` instead of " "``access``)." @@ -2225,8 +2224,8 @@ 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 " "operate on the symbolic link itself rather than the file pointed to by the " -"link. (For POSIX systems, Python will call the ``l...`` variant of the " -"function.)" +"link. For POSIX systems, Python will call the ``l...`` variant of the " +"function." msgstr "" #: ../../library/os.rst:2044 @@ -3659,7 +3658,7 @@ msgstr "" #: ../../library/os.rst:3228 msgid "``st_birthtime`` is now available on Windows." -msgstr "" +msgstr "``st_birthtime`` 現在在 Windows 上可用。" #: ../../library/os.rst:3233 msgid "" diff --git a/library/pathlib.po b/library/pathlib.po index 293165e97a..63bea451b4 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -2081,6 +2081,17 @@ msgid "" "...\n" "directory" msgstr "" +">>> p = Path('src')\n" +">>> if p.info.is_symlink():\n" +"... print('symlink')\n" +"... elif p.info.is_dir():\n" +"... print('directory')\n" +"... elif p.info.exists():\n" +"... print('something else')\n" +"... else:\n" +"... print('not found')\n" +"...\n" +"directory" #: ../../library/pathlib.rst:1207 msgid "" diff --git a/library/pickle.po b/library/pickle.po index e13aa65317..fbabbf46b3 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -2437,7 +2437,7 @@ msgstr "" #: ../../library/pickle.rst:1224 msgid "python -m pickle pickle_file [pickle_file ...]" -msgstr "" +msgstr "python -m pickle pickle_file [pickle_file ...]" #: ../../library/pickle.rst:1228 msgid "The following option is accepted:" diff --git a/library/platform.po b/library/platform.po index 7e2ed8e70b..24e80e0681 100644 --- a/library/platform.po +++ b/library/platform.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查" -"詢 :data:`sys.maxsize` 屬性: ::" +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." +"maxsize` 屬性: ::" #: ../../library/platform.rst:51 msgid "is_64bits = sys.maxsize > 2**32" @@ -101,7 +101,13 @@ msgid "" "the value cannot be determined." msgstr "回傳機器種類,例如 ``'AMD64'``。如果該值無法確定則會回傳一個空字串。" -#: ../../library/platform.rst:62 +#: ../../library/platform.rst:59 +msgid "" +"The output is platform-dependent and may differ in casing and naming " +"conventions." +msgstr "" + +#: ../../library/platform.rst:64 msgid "" "Returns the computer's network name (may not be fully qualified!). An empty " "string is returned if the value cannot be determined." @@ -109,13 +115,13 @@ msgstr "" "回傳電腦的網路名稱(可能不是完整名稱!)。如果該值無法確定則會回傳一個空字" "串。" -#: ../../library/platform.rst:68 +#: ../../library/platform.rst:70 msgid "" "Returns a single string identifying the underlying platform with as much " "useful information as possible." msgstr "會儘可能附帶有用資訊地回傳一個標識底層平臺的字串。" -#: ../../library/platform.rst:71 +#: ../../library/platform.rst:73 msgid "" "The output is intended to be *human readable* rather than machine parseable. " "It may look different on different platforms and this is intended." @@ -123,7 +129,7 @@ msgstr "" "輸出應為\\ *人類易讀的 (human readable)*,而非機器易剖析的 (machine " "parseable)。它在不同平臺上看起來可能不一致,這是有意為之的。" -#: ../../library/platform.rst:74 +#: ../../library/platform.rst:76 msgid "" "If *aliased* is true, the function will use aliases for various platforms " "that report system names which differ from their common names, for example " @@ -134,13 +140,13 @@ msgstr "" "稱,例如 SunOS 將被回報為 Solaris。:func:`system_alias` 函式被用於實作此功" "能。" -#: ../../library/platform.rst:79 +#: ../../library/platform.rst:81 msgid "" "Setting *terse* to true causes the function to return only the absolute " "minimum information needed to identify the platform." msgstr "將 *terse* 設為真值將導致此函式只回傳標識平臺所需的最小量資訊。" -#: ../../library/platform.rst:82 +#: ../../library/platform.rst:84 msgid "" "On macOS, the function now uses :func:`mac_ver`, if it returns a non-empty " "release string, to get the macOS version rather than the darwin version." @@ -148,11 +154,11 @@ msgstr "" "在 macOS 上,如果 :func:`mac_ver` 回傳的釋出版字串非空字串,此函式現在會使用" "它以取得 macOS 版本而非 darwin 版本。" -#: ../../library/platform.rst:90 +#: ../../library/platform.rst:92 msgid "Returns the (real) processor name, e.g. ``'amdk6'``." msgstr "回傳(真實的)處理器名稱,例如 ``'amdk6'``。" -#: ../../library/platform.rst:92 +#: ../../library/platform.rst:94 msgid "" "An empty string is returned if the value cannot be determined. Note that " "many platforms do not provide this information or simply return the same " @@ -161,7 +167,7 @@ msgstr "" "如果該值無法確定則將回傳空字串。請注意,許多平臺都不提供此資訊或是簡單地回傳" "與 :func:`machine` 相同的值。NetBSD 則會提供此資訊。" -#: ../../library/platform.rst:99 +#: ../../library/platform.rst:101 msgid "" "Returns a tuple ``(buildno, builddate)`` stating the Python build number and " "date as strings." @@ -169,15 +175,15 @@ msgstr "" "回傳一個 tuple ``(buildno, builddate)``,表示字串形式的 Python 建置編號和日" "期。" -#: ../../library/platform.rst:105 +#: ../../library/platform.rst:107 msgid "Returns a string identifying the compiler used for compiling Python." msgstr "回傳一個標識用於編譯 Python 的編譯器的字串。" -#: ../../library/platform.rst:110 +#: ../../library/platform.rst:112 msgid "Returns a string identifying the Python implementation SCM branch." msgstr "回傳一個標識 Python 實作 SCM 分支的字串。" -#: ../../library/platform.rst:115 +#: ../../library/platform.rst:117 msgid "" "Returns a string identifying the Python implementation. Possible return " "values are: 'CPython', 'IronPython', 'Jython', 'PyPy'." @@ -185,15 +191,15 @@ msgstr "" "回傳一個標識 Python 實作的字串。可能的回傳值" "有:'CPython'、'IronPython'、'Jython'、'PyPy'。" -#: ../../library/platform.rst:121 +#: ../../library/platform.rst:123 msgid "Returns a string identifying the Python implementation SCM revision." msgstr "回傳一個標識 Python 實作 SCM 修訂版的字串。" -#: ../../library/platform.rst:126 +#: ../../library/platform.rst:128 msgid "Returns the Python version as string ``'major.minor.patchlevel'``." msgstr "將 Python 版本以字串 ``'major.minor.patchlevel'`` 形式回傳。" -#: ../../library/platform.rst:128 +#: ../../library/platform.rst:130 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to 0)." @@ -201,13 +207,13 @@ msgstr "" "請注意此回傳值不同於 Python ``sys.version``,它總是會包括 patchlevel(預設為 " "``'0'``\\ )。" -#: ../../library/platform.rst:134 +#: ../../library/platform.rst:136 msgid "" "Returns the Python version as tuple ``(major, minor, patchlevel)`` of " "strings." msgstr "將 Python 版本以字串 tuple ``(major, minor, patchlevel)`` 形式回傳。" -#: ../../library/platform.rst:136 +#: ../../library/platform.rst:138 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to ``'0'``)." @@ -215,7 +221,7 @@ msgstr "" "請注意此回傳值不同於 Python ``sys.version``,它總是會包括 patchlevel(預設為 " "``'0'``\\ )。" -#: ../../library/platform.rst:142 +#: ../../library/platform.rst:144 msgid "" "Returns the system's release, e.g. ``'2.2.0'`` or ``'NT'``. An empty string " "is returned if the value cannot be determined." @@ -223,7 +229,7 @@ msgstr "" "回傳系統的釋出版本,例如 ``'2.2.0'`` 或 ``'NT'``,如果該值無法確定則將回傳一" "個空字串。" -#: ../../library/platform.rst:148 +#: ../../library/platform.rst:150 msgid "" "Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, " "``'Windows'``. An empty string is returned if the value cannot be determined." @@ -231,14 +237,14 @@ msgstr "" "回傳系統/OS 的名稱,例如 ``'Linux'``、``'Darwin'``、``'Java'``、" "``'Windows'``。如果該值無法確定則回傳一個空字串。" -#: ../../library/platform.rst:151 +#: ../../library/platform.rst:153 msgid "" "On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, " "``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or " "``'Linux'``), use :func:`os.uname`." msgstr "" -#: ../../library/platform.rst:157 +#: ../../library/platform.rst:159 msgid "" "Returns ``(system, release, version)`` aliased to common marketing names " "used for some systems. It also does some reordering of the information in " @@ -247,7 +253,7 @@ msgstr "" "回傳做為某些系統所使用的常見行銷名稱之別名的 ``(system, release, version)``。" "它還會在可能導致混淆的情況下對資訊進行一些重新排序。" -#: ../../library/platform.rst:164 +#: ../../library/platform.rst:166 msgid "" "Returns the system's release version, e.g. ``'#3 on degas'``. An empty " "string is returned if the value cannot be determined." @@ -255,64 +261,62 @@ msgstr "" "回傳系統的釋出版本資訊,例如 ``'#3 on degas'``。如果該值無法確定則將回傳一個" "空字串。" -#: ../../library/platform.rst:167 +#: ../../library/platform.rst:169 msgid "" "On iOS and Android, this is the user-facing OS version. To obtain the Darwin " "or Linux kernel version, use :func:`os.uname`." msgstr "" -#: ../../library/platform.rst:172 +#: ../../library/platform.rst:174 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " -"containing six " -"attributes: :attr:`system`, :attr:`node`, :attr:`release`, :attr:`version`, :attr:`machine`, " -"and :attr:`processor`." +"containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" +"attr:`version`, :attr:`machine`, and :attr:`processor`." msgstr "" -"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性" -"的 :func:`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:attr:`version`、:attr:`machine` " -"和 :attr:`processor`。" +"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性的 :func:" +"`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" +"attr:`version`、:attr:`machine` 和 :attr:`processor`。" -#: ../../library/platform.rst:176 +#: ../../library/platform.rst:178 msgid ":attr:`processor` is resolved late, on demand." msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" -#: ../../library/platform.rst:178 +#: ../../library/platform.rst:180 msgid "" -"Note: the first two attribute names differ from the names presented " -"by :func:`os.uname`, where they are named :attr:`!sysname` and :attr:`!" -"nodename`." +"Note: the first two attribute names differ from the names presented by :func:" +"`os.uname`, where they are named :attr:`!sysname` and :attr:`!nodename`." msgstr "" -"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名" -"為 :attr:`!sysname` 和 :attr:`!nodename`。" +"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" +"`!sysname` 和 :attr:`!nodename`。" -#: ../../library/platform.rst:182 +#: ../../library/platform.rst:184 msgid "Entries which cannot be determined are set to ``''``." msgstr "無法確定的條目會被設為 ``''``。" -#: ../../library/platform.rst:184 +#: ../../library/platform.rst:186 msgid "Result changed from a tuple to a :func:`~collections.namedtuple`." msgstr "將結果從 tuple 改為 :func:`~collections.namedtuple`。" -#: ../../library/platform.rst:187 +#: ../../library/platform.rst:189 msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" -#: ../../library/platform.rst:192 +#: ../../library/platform.rst:194 msgid "" "Clear out the internal cache of information, such as the :func:`uname`. This " "is typically useful when the platform's :func:`node` is changed by an " "external process and one needs to retrieve the updated value." msgstr "" -#: ../../library/platform.rst:200 +#: ../../library/platform.rst:202 msgid "Java platform" msgstr "Java 平台" -#: ../../library/platform.rst:205 +#: ../../library/platform.rst:207 msgid "Version interface for Jython." msgstr "Jython 的版本介面。" -#: ../../library/platform.rst:207 +#: ../../library/platform.rst:209 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " @@ -324,17 +328,17 @@ msgstr "" "os_version, os_arch)``。無法確定的值將被設為由參數所給定的預設值(預設均為 " "``''``\\ )。" -#: ../../library/platform.rst:212 +#: ../../library/platform.rst:214 msgid "" "It was largely untested, had a confusing API, and was only useful for Jython " "support." msgstr "" -#: ../../library/platform.rst:218 +#: ../../library/platform.rst:220 msgid "Windows platform" msgstr "Windows 平台" -#: ../../library/platform.rst:223 +#: ../../library/platform.rst:225 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -346,20 +350,20 @@ msgstr "" "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" -#: ../../library/platform.rst:229 +#: ../../library/platform.rst:231 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " "``'Free'`` refers to the OS version being free of debugging code. It could " -"also state ``'Checked'`` which means the OS version uses debugging code, " -"i.e. code that checks arguments, ranges, etc." +"also state ``'Checked'`` which means the OS version uses debugging code, i." +"e. code that checks arguments, ranges, etc." msgstr "" "一點提示:*ptype* 在單個處理器的 NT 機器上為 ``'Uniprocessor Free'``,而在多" "個處理器的機器上為 ``'Multiprocessor Free'``。``'Free'`` 是指該 OS 版本沒有除" "錯程式。它也可能以 ``'Checked'`` 表示,代表該 OS 版本使用了除錯程式,即檢查引" "數、範圍等的程式。" -#: ../../library/platform.rst:237 +#: ../../library/platform.rst:239 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " @@ -369,7 +373,7 @@ msgstr "" "回傳一個代表目前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" -#: ../../library/platform.rst:245 +#: ../../library/platform.rst:247 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." @@ -377,11 +381,11 @@ msgstr "" "如果 :func:`win32_edition` 回傳的 Windows 版本被識別為 IoT 版則回傳 " "``True``。" -#: ../../library/platform.rst:252 +#: ../../library/platform.rst:254 msgid "macOS platform" msgstr "macOS 平台" -#: ../../library/platform.rst:256 +#: ../../library/platform.rst:258 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " @@ -391,53 +395,53 @@ msgstr "" "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" -#: ../../library/platform.rst:260 +#: ../../library/platform.rst:262 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" -#: ../../library/platform.rst:264 +#: ../../library/platform.rst:266 msgid "iOS platform" msgstr "iOS 平台" -#: ../../library/platform.rst:268 +#: ../../library/platform.rst:270 msgid "" -"Get iOS version information and return it as " -"a :func:`~collections.namedtuple` with the following attributes:" +"Get iOS version information and return it as a :func:`~collections." +"namedtuple` with the following attributes:" msgstr "" -#: ../../library/platform.rst:271 +#: ../../library/platform.rst:273 msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." msgstr "``system`` 是 OS 名稱;可能是 ``'iOS'`` 或 ``'iPadOS'``。" -#: ../../library/platform.rst:272 +#: ../../library/platform.rst:274 msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." msgstr "" -#: ../../library/platform.rst:273 +#: ../../library/platform.rst:275 msgid "" "``model`` is the device model identifier; this will be a string like " "``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." msgstr "" -#: ../../library/platform.rst:275 +#: ../../library/platform.rst:277 msgid "" "``is_simulator`` is a boolean describing if the app is running on a " "simulator or a physical device." msgstr "" -#: ../../library/platform.rst:278 +#: ../../library/platform.rst:280 msgid "" "Entries which cannot be determined are set to the defaults given as " "parameters." msgstr "無法確定的條目會被設定為以參數給定的預設值。" -#: ../../library/platform.rst:283 +#: ../../library/platform.rst:285 msgid "Unix platforms" msgstr "Unix 平台" -#: ../../library/platform.rst:287 +#: ../../library/platform.rst:289 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " @@ -447,7 +451,7 @@ msgstr "" "嘗試確認可執行檔案(預設為 Python 直譯器)所連結到的 libc 版本。回傳一個字串 " "tuple ``(lib, version)``,當查詢失敗時其預設值將被設為給定的參數值。" -#: ../../library/platform.rst:291 +#: ../../library/platform.rst:293 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " @@ -456,15 +460,15 @@ msgstr "" "請注意,此函式對於不同 libc 版本如何為可執行檔案新增符號的方式有深層的關聯," "可能僅適用於以 :program:`gcc` 編譯出來的可執行檔案。" -#: ../../library/platform.rst:295 +#: ../../library/platform.rst:297 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" -#: ../../library/platform.rst:299 +#: ../../library/platform.rst:301 msgid "Linux platforms" msgstr "Linux 平台" -#: ../../library/platform.rst:303 +#: ../../library/platform.rst:305 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" -#: ../../library/platform.rst:309 +#: ../../library/platform.rst:311 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" -"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" -"發 :exc:`OSError` 或其子類別。" +"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" +"`OSError` 或其子類別。" -#: ../../library/platform.rst:312 +#: ../../library/platform.rst:314 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -498,7 +502,7 @@ msgstr "" "``PRETTY_NAME`` 總會按照標準來定義。所有其他欄位都是可選的。根據不同廠商可能" "會包括額外的欄位。" -#: ../../library/platform.rst:318 +#: ../../library/platform.rst:320 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " @@ -509,11 +513,11 @@ msgstr "" "串。程式應當使用 ``ID``、``ID_LIKE``、``VERSION_ID`` 或 ``VARIANT_ID`` 等欄位" "來標識 Linux 發行版。" -#: ../../library/platform.rst:323 +#: ../../library/platform.rst:325 msgid "Example::" msgstr "範例: ::" -#: ../../library/platform.rst:325 +#: ../../library/platform.rst:327 msgid "" "def get_like_distro():\n" " info = platform.freedesktop_os_release()\n" @@ -524,95 +528,92 @@ msgid "" " return ids" msgstr "" -#: ../../library/platform.rst:337 +#: ../../library/platform.rst:339 msgid "Android platform" msgstr "Android 平台" -#: ../../library/platform.rst:342 +#: ../../library/platform.rst:344 msgid "" "Get Android device information. Returns a :func:`~collections.namedtuple` " "with the following attributes. Values which cannot be determined are set to " "the defaults given as parameters." msgstr "" -#: ../../library/platform.rst:346 +#: ../../library/platform.rst:348 msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." msgstr "" -#: ../../library/platform.rst:348 +#: ../../library/platform.rst:350 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " -"for Android 14). To get the API level which Python was built against, " -"see :func:`sys.getandroidapilevel`." +"for Android 14). To get the API level which Python was built against, see :" +"func:`sys.getandroidapilevel`." msgstr "" -#: ../../library/platform.rst:352 +#: ../../library/platform.rst:354 msgid "" "``manufacturer`` - `Manufacturer name `__." msgstr "" -#: ../../library/platform.rst:355 +#: ../../library/platform.rst:357 msgid "" "``model`` - `Model name `__ – typically the marketing name or model number." msgstr "" -#: ../../library/platform.rst:359 +#: ../../library/platform.rst:361 msgid "" "``device`` - `Device name `__ – typically the model number or a codename." msgstr "" -#: ../../library/platform.rst:363 +#: ../../library/platform.rst:365 msgid "" "``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " "physical device." msgstr "" -#: ../../library/platform.rst:366 +#: ../../library/platform.rst:368 msgid "" -"Google maintains a `list of known model and device names `__." +"Google maintains a `list of known model and device names `__." msgstr "" -#: ../../library/platform.rst:374 +#: ../../library/platform.rst:376 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/platform.rst:376 +#: ../../library/platform.rst:378 msgid "" ":mod:`platform` can also be invoked directly using the :option:`-m` switch " "of the interpreter::" msgstr "" -#: ../../library/platform.rst:379 +#: ../../library/platform.rst:381 msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" -#: ../../library/platform.rst:381 +#: ../../library/platform.rst:383 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/platform.rst:387 +#: ../../library/platform.rst:389 msgid "" -"Print terse information about the platform. This is equivalent to " -"calling :func:`platform.platform` with the *terse* argument set to ``True``." +"Print terse information about the platform. This is equivalent to calling :" +"func:`platform.platform` with the *terse* argument set to ``True``." msgstr "" -#: ../../library/platform.rst:392 +#: ../../library/platform.rst:394 msgid "" "Print platform information without system/OS name aliasing. This is " "equivalent to calling :func:`platform.platform` with the *aliased* argument " "set to ``True``." msgstr "" -#: ../../library/platform.rst:396 +#: ../../library/platform.rst:398 msgid "" "You can also pass one or more positional arguments (``terse``, " "``nonaliased``) to explicitly control the output format. These behave " "similarly to their corresponding options." msgstr "" - -#~ msgid "Miscellaneous" -#~ msgstr "雜項" diff --git a/library/plistlib.po b/library/plistlib.po index 7525bc142c..025b7f6491 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -98,15 +98,15 @@ msgstr "" #: ../../library/plistlib.rst:63 msgid ":data:`None`: Autodetect the file format" -msgstr "" +msgstr ":data:`None`:自動偵測檔案格式" #: ../../library/plistlib.rst:65 msgid ":data:`FMT_XML`: XML file format" -msgstr "" +msgstr ":data:`FMT_XML`:XML 檔案格式" #: ../../library/plistlib.rst:67 msgid ":data:`FMT_BINARY`: Binary plist format" -msgstr "" +msgstr ":data:`FMT_BINARY`:二進位 plist 格式" #: ../../library/plistlib.rst:69 msgid "" diff --git a/library/pprint.po b/library/pprint.po index 7a0e5fc47a..324d72d73a 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-10-13 00:14+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-" @@ -43,22 +43,18 @@ msgid "" msgstr "" #: ../../library/pprint.rst:25 -msgid "Dictionaries are sorted by key before the display is computed." -msgstr "" - -#: ../../library/pprint.rst:27 msgid "Added support for pretty-printing :class:`types.SimpleNamespace`." msgstr "" -#: ../../library/pprint.rst:30 +#: ../../library/pprint.rst:28 msgid "Added support for pretty-printing :class:`dataclasses.dataclass`." msgstr "" -#: ../../library/pprint.rst:36 +#: ../../library/pprint.rst:34 msgid "Functions" msgstr "函式" -#: ../../library/pprint.rst:41 +#: ../../library/pprint.rst:39 msgid "" "Prints the formatted representation of *object*, followed by a newline. This " "function may be used in the interactive interpreter instead of the :func:" @@ -70,28 +66,28 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/pprint.rst:46 +#: ../../library/pprint.rst:44 msgid "The object to be printed." msgstr "將被印出的物件。" -#: ../../library/pprint.rst:49 +#: ../../library/pprint.rst:47 msgid "" "A file-like object to which the output will be written by calling its :meth:" "`!write` method. If ``None`` (the default), :data:`sys.stdout` is used." msgstr "" -#: ../../library/pprint.rst:55 +#: ../../library/pprint.rst:53 msgid "The amount of indentation added for each nesting level." msgstr "" -#: ../../library/pprint.rst:58 +#: ../../library/pprint.rst:56 msgid "" "The desired maximum number of characters per line in the output. If a " "structure cannot be formatted within the width constraint, a best effort " "will be made." msgstr "" -#: ../../library/pprint.rst:63 +#: ../../library/pprint.rst:61 msgid "" "The number of nesting levels which may be printed. If the data structure " "being printed is too deep, the next contained level is replaced by ``...``. " @@ -99,7 +95,7 @@ msgid "" "objects being formatted." msgstr "" -#: ../../library/pprint.rst:71 +#: ../../library/pprint.rst:69 msgid "" "Control the way long :term:`sequences ` are formatted. If " "``False`` (the default), each item of a sequence will be formatted on a " @@ -107,26 +103,26 @@ msgid "" "be formatted on each output line." msgstr "" -#: ../../library/pprint.rst:78 +#: ../../library/pprint.rst:76 msgid "" "If ``True``, dictionaries will be formatted with their keys sorted, " "otherwise they will be displayed in insertion order (the default)." msgstr "" -#: ../../library/pprint.rst:83 +#: ../../library/pprint.rst:81 msgid "" "If ``True``, integers will be formatted with the ``_`` character for a " "thousands separator, otherwise underscores are not displayed (the default)." msgstr "" -#: ../../library/pprint.rst:105 +#: ../../library/pprint.rst:103 msgid "" "Alias for :func:`~pprint.pp` with *sort_dicts* set to ``True`` by default, " "which would automatically sort the dictionaries' keys, you might want to " "use :func:`~pprint.pp` instead where it is ``False`` by default." msgstr "" -#: ../../library/pprint.rst:113 +#: ../../library/pprint.rst:111 msgid "" "Return the formatted representation of *object* as a string. *indent*, " "*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " @@ -134,21 +130,21 @@ msgid "" "and their meanings are as described in the documentation above." msgstr "" -#: ../../library/pprint.rst:123 +#: ../../library/pprint.rst:121 msgid "" "Determine if the formatted representation of *object* is \"readable\", or " "can be used to reconstruct the value using :func:`eval`. This always " "returns ``False`` for recursive objects." msgstr "" -#: ../../library/pprint.rst:133 +#: ../../library/pprint.rst:131 msgid "" "Determine if *object* requires a recursive representation. This function is " "subject to the same limitations as noted in :func:`saferepr` below and may " "raise an :exc:`RecursionError` if it fails to detect a recursive object." msgstr "" -#: ../../library/pprint.rst:140 +#: ../../library/pprint.rst:138 msgid "" "Return a string representation of *object*, protected against recursion in " "some common data structures, namely instances of :class:`dict`, :class:" @@ -158,53 +154,53 @@ msgid "" "id=number>``. The representation is not otherwise formatted." msgstr "" -#: ../../library/pprint.rst:153 +#: ../../library/pprint.rst:151 msgid "PrettyPrinter Objects" msgstr "PrettyPrinter 物件" -#: ../../library/pprint.rst:160 +#: ../../library/pprint.rst:158 msgid "Construct a :class:`PrettyPrinter` instance." msgstr "建立一個 :class:`PrettyPrinter` 實例。" -#: ../../library/pprint.rst:162 +#: ../../library/pprint.rst:160 msgid "" "Arguments have the same meaning as for :func:`~pprint.pp`. Note that they " "are in a different order, and that *sort_dicts* defaults to ``True``." msgstr "" -#: ../../library/pprint.rst:189 +#: ../../library/pprint.rst:187 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/pprint.rst:192 +#: ../../library/pprint.rst:190 msgid "Added the *sort_dicts* parameter." msgstr "新增 *sort_dicts* 參數。" -#: ../../library/pprint.rst:195 +#: ../../library/pprint.rst:193 msgid "Added the *underscore_numbers* parameter." msgstr "新增 *underscore_numbers* 參數。" -#: ../../library/pprint.rst:198 +#: ../../library/pprint.rst:196 msgid "No longer attempts to write to :data:`!sys.stdout` if it is ``None``." msgstr "" -#: ../../library/pprint.rst:202 +#: ../../library/pprint.rst:200 msgid ":class:`PrettyPrinter` instances have the following methods:" msgstr ":class:`PrettyPrinter` 實例有以下方法:" -#: ../../library/pprint.rst:207 +#: ../../library/pprint.rst:205 msgid "" "Return the formatted representation of *object*. This takes into account " "the options passed to the :class:`PrettyPrinter` constructor." msgstr "" -#: ../../library/pprint.rst:213 +#: ../../library/pprint.rst:211 msgid "" "Print the formatted representation of *object* on the configured stream, " "followed by a newline." msgstr "" -#: ../../library/pprint.rst:216 +#: ../../library/pprint.rst:214 msgid "" "The following methods provide the implementations for the corresponding " "functions of the same names. Using these methods on an instance is slightly " @@ -212,7 +208,7 @@ msgid "" "created." msgstr "" -#: ../../library/pprint.rst:226 +#: ../../library/pprint.rst:224 msgid "" "Determine if the formatted representation of the object is \"readable,\" or " "can be used to reconstruct the value using :func:`eval`. Note that this " @@ -221,18 +217,18 @@ msgid "" "returns ``False``." msgstr "" -#: ../../library/pprint.rst:235 +#: ../../library/pprint.rst:233 msgid "Determine if the object requires a recursive representation." msgstr "" -#: ../../library/pprint.rst:237 +#: ../../library/pprint.rst:235 msgid "" "This method is provided as a hook to allow subclasses to modify the way " "objects are converted to strings. The default implementation uses the " "internals of the :func:`saferepr` implementation." msgstr "" -#: ../../library/pprint.rst:244 +#: ../../library/pprint.rst:242 msgid "" "Returns three values: the formatted version of *object* as a string, a flag " "indicating whether the result is readable, and a flag indicating whether " @@ -250,18 +246,18 @@ msgid "" "of the current call." msgstr "" -#: ../../library/pprint.rst:262 +#: ../../library/pprint.rst:260 msgid "Example" msgstr "範例" -#: ../../library/pprint.rst:264 +#: ../../library/pprint.rst:262 msgid "" "To demonstrate several uses of the :func:`~pprint.pp` function and its " "parameters, let's fetch information about a project from `PyPI `_::" msgstr "" -#: ../../library/pprint.rst:267 +#: ../../library/pprint.rst:265 msgid "" ">>> import json\n" ">>> import pprint\n" @@ -275,11 +271,11 @@ msgstr "" ">>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:\n" "... project_info = json.load(resp)['info']" -#: ../../library/pprint.rst:273 +#: ../../library/pprint.rst:271 msgid "In its basic form, :func:`~pprint.pp` shows the whole object::" msgstr "" -#: ../../library/pprint.rst:275 +#: ../../library/pprint.rst:273 msgid "" ">>> pprint.pp(project_info)\n" "{'author': 'The Python Packaging Authority',\n" @@ -395,13 +391,13 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:329 +#: ../../library/pprint.rst:327 msgid "" "The result can be limited to a certain *depth* (ellipsis is used for deeper " "contents)::" msgstr "" -#: ../../library/pprint.rst:332 +#: ../../library/pprint.rst:330 msgid "" ">>> pprint.pp(project_info, depth=1)\n" "{'author': 'The Python Packaging Authority',\n" @@ -495,13 +491,13 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:375 +#: ../../library/pprint.rst:373 msgid "" "Additionally, maximum character *width* can be suggested. If a long object " "cannot be split, the specified width will be exceeded::" msgstr "" -#: ../../library/pprint.rst:378 +#: ../../library/pprint.rst:376 msgid "" ">>> pprint.pp(project_info, depth=1, width=60)\n" "{'author': 'The Python Packaging Authority',\n" @@ -595,18 +591,18 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 +#: ../../library/pprint.rst:119 ../../library/pprint.rst:222 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 +#: ../../library/pprint.rst:119 ../../library/pprint.rst:222 msgid "eval" msgstr "eval" -#: ../../library/pprint.rst:155 +#: ../../library/pprint.rst:153 msgid "..." msgstr "..." -#: ../../library/pprint.rst:155 +#: ../../library/pprint.rst:153 msgid "placeholder" msgstr "placeholder(佔位符號)" diff --git a/library/queue.po b/library/queue.po index 37d2064dea..434dd0f202 100644 --- a/library/queue.po +++ b/library/queue.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,11 +50,11 @@ msgid "" "kept sorted (using the :mod:`heapq` module) and the lowest valued entry is " "retrieved first." msgstr "" -"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。" -"在 :abbr:`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。" -"在 :abbr:`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的" -"(像堆疊 (stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序" -"狀態(使用 :mod:`heapq` module),並先取出最低值條目。" +"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。在 :abbr:" +"`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。在 :abbr:" +"`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的(像堆疊 " +"(stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序狀態(使" +"用 :mod:`heapq` module),並先取出最低值條目。" #: ../../library/queue.rst:24 msgid "" @@ -159,30 +159,27 @@ msgstr "" #: ../../library/queue.rst:84 msgid "" -"Exception raised when non-blocking :meth:`~Queue.get` " -"(or :meth:`~Queue.get_nowait`) is called on a :class:`Queue` object which is " -"empty." +"Exception raised when non-blocking :meth:`~Queue.get` (or :meth:`~Queue." +"get_nowait`) is called on a :class:`Queue` object which is empty." msgstr "" -"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-" -"blocking) :meth:`~Queue.get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例" -"外。" +"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue." +"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。" #: ../../library/queue.rst:91 msgid "" -"Exception raised when non-blocking :meth:`~Queue.put` " -"(or :meth:`~Queue.put_nowait`) is called on a :class:`Queue` object which is " -"full." +"Exception raised when non-blocking :meth:`~Queue.put` (or :meth:`~Queue." +"put_nowait`) is called on a :class:`Queue` object which is full." msgstr "" -"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ " -"(或 :meth:`~Queue.put_nowait`\\ )將引發此例外。" +"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :" +"meth:`~Queue.put_nowait`\\ )將引發此例外。" #: ../../library/queue.rst:98 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a :class:`Queue` object which has been shut down." msgstr "" -"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` " -"或 :meth:`~Queue.get` 時將引發此例外。" +"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` 或 :meth:`~Queue." +"get` 時將引發此例外。" #: ../../library/queue.rst:107 msgid "Queue Objects" @@ -190,8 +187,8 @@ msgstr "佇列物件" #: ../../library/queue.rst:109 msgid "" -"Queue objects (:class:`Queue`, :class:`LifoQueue`, " -"or :class:`PriorityQueue`) provide the public methods described below." +"Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" +"`PriorityQueue`) provide the public methods described below." msgstr "" "佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下" "面描述的公用 method。" @@ -251,7 +248,7 @@ msgstr "如果佇列已被關閉,則引發 :exc:`ShutDown`。" msgid "Equivalent to ``put(item, block=False)``." msgstr "等效於 ``put(item, block=False)``。" -#: ../../library/queue.rst:156 ../../library/queue.rst:297 +#: ../../library/queue.rst:156 ../../library/queue.rst:313 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -263,17 +260,17 @@ msgid "" msgstr "" "從佇列中移除並回傳一個項目。如果可選的 args *block* 為 true,且 *timeout* 為 " "``None``\\ (預設值),則在必要時阻塞,直到有可用的項目。如果 *timeout* 是正" -"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引" -"發 :exc:`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項" -"目,否則引發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" +"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引發 :exc:" +"`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引" +"發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" #: ../../library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " "uninterruptible wait on an underlying lock. This means that no exceptions " -"can occur, and in particular a SIGINT will not trigger " -"a :exc:`KeyboardInterrupt`." +"can occur, and in particular a SIGINT will not trigger a :exc:" +"`KeyboardInterrupt`." msgstr "" "在 POSIX 系統的 3.0 版之前,以及 Windows 的所有版本,如果 *block* 為 true 且 " "*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例" @@ -285,7 +282,7 @@ msgid "" "the queue has been shut down immediately." msgstr "如果佇列已被關閉且為空,或佇列已立即關閉,則引發 :exc:`ShutDown`。" -#: ../../library/queue.rst:174 ../../library/queue.rst:307 +#: ../../library/queue.rst:174 ../../library/queue.rst:323 msgid "Equivalent to ``get(False)``." msgstr "等效於 ``get(False)``。" @@ -300,9 +297,8 @@ msgstr "" #: ../../library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " -"threads. For each :meth:`get` used to fetch a task, a subsequent call " -"to :meth:`task_done` tells the queue that the processing on the task is " -"complete." +"threads. For each :meth:`get` used to fetch a task, a subsequent call to :" +"meth:`task_done` tells the queue that the processing on the task is complete." msgstr "" "表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每" "個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。" @@ -313,36 +309,34 @@ msgid "" "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`put` into the queue)." msgstr "" -"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於" -"以 :meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" +"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :" +"meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" #: ../../library/queue.rst:190 msgid "" -"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " -"in the queue." -msgstr "" - -#: ../../library/queue.rst:193 -msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。" -#: ../../library/queue.rst:199 +#: ../../library/queue.rst:196 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "持續阻塞直到佇列中的所有項目都已被取得並處理完畢。" -#: ../../library/queue.rst:201 +#: ../../library/queue.rst:198 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer thread " -"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 thread 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 "" +"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼叫 :meth:" +"`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。" +"當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" + +#: ../../library/queue.rst:205 +msgid "Waiting for task completion" msgstr "" -"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼" -"叫 :meth:`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就" -"會下降。當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" #: ../../library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" @@ -380,48 +374,72 @@ msgstr "" #: ../../library/queue.rst:236 msgid "" -":class:`Queue` objects can be made to prevent further interaction by " -"shutting them down." +"When no longer needed, :class:`Queue` objects can be wound down until empty " +"or terminated immediately with a hard shutdown." msgstr "" #: ../../library/queue.rst:241 -msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`ShutDown`." +msgid "Put a :class:`Queue` instance into a shutdown mode." msgstr "" -#: ../../library/queue.rst:244 +#: ../../library/queue.rst:243 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." +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`ShutDown` in the formerly blocked thread." msgstr "" #: ../../library/queue.rst:248 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`." +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" + +#: ../../library/queue.rst:252 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." +msgstr "" + +#: ../../library/queue.rst:255 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`ShutDown`." +msgstr "" + +#: ../../library/queue.rst:258 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty. All callers of :meth:`~Queue.join` are " +"unblocked regardless of the number of unfinished tasks. Blocked callers of :" +"meth:`~Queue.get` are unblocked and will raise :exc:`ShutDown` because the " +"queue is empty." +msgstr "" + +#: ../../library/queue.rst:265 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." msgstr "" -#: ../../library/queue.rst:257 +#: ../../library/queue.rst:273 msgid "SimpleQueue Objects" msgstr "SimpleQueue 物件" -#: ../../library/queue.rst:259 +#: ../../library/queue.rst:275 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。" -#: ../../library/queue.rst:263 +#: ../../library/queue.rst:279 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" "傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。" -#: ../../library/queue.rst:269 +#: ../../library/queue.rst:285 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " @@ -430,7 +448,7 @@ msgstr "" "如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:276 +#: ../../library/queue.rst:292 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -441,7 +459,7 @@ msgstr "" "像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了" "與 :meth:`Queue.put` 相容才存在。" -#: ../../library/queue.rst:282 +#: ../../library/queue.rst:298 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -454,18 +472,18 @@ msgstr "" "鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使" "用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。" -#: ../../library/queue.rst:291 +#: ../../library/queue.rst:307 msgid "" -"Equivalent to ``put(item, block=False)``, provided for compatibility " -"with :meth:`Queue.put_nowait`." +"Equivalent to ``put(item, block=False)``, provided for compatibility with :" +"meth:`Queue.put_nowait`." msgstr "" "等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。" -#: ../../library/queue.rst:312 +#: ../../library/queue.rst:328 msgid "Class :class:`multiprocessing.Queue`" msgstr "Class :class:`multiprocessing.Queue`" -#: ../../library/queue.rst:313 +#: ../../library/queue.rst:329 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." @@ -473,12 +491,12 @@ msgstr "" "用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 " "class。" -#: ../../library/queue.rst:316 +#: ../../library/queue.rst:332 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " -"queues with fast atomic :meth:`~collections.deque.append` " -"and :meth:`~collections.deque.popleft` operations that do not require " -"locking and also support indexing." +"queues with fast atomic :meth:`~collections.deque.append` and :meth:" +"`~collections.deque.popleft` operations that do not require locking and also " +"support indexing." msgstr "" ":class:`collections.deque` 是無界佇列的替代實作,有快速且具原子性 (atomic) " "的 :meth:`~collections.deque.append` 和 :meth:`~collections.deque.popleft` 操" diff --git a/library/re.po b/library/re.po index 3144c750c0..60b0905870 100644 --- a/library/re.po +++ b/library/re.po @@ -963,7 +963,7 @@ msgstr "" #: ../../library/re.rst:667 msgid "``\\z``" -msgstr "" +msgstr "``\\z``" #: ../../library/re.rst:668 msgid "Matches only at the end of the string." @@ -2994,7 +2994,7 @@ msgstr "\\W" #: ../../library/re.rst:664 msgid "\\z" -msgstr "" +msgstr "\\z" #: ../../library/re.rst:664 msgid "\\Z" diff --git a/library/resource.po b/library/resource.po index 5dc559f788..251df93e97 100644 --- a/library/resource.po +++ b/library/resource.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-10-21 00:14+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-" @@ -28,11 +28,11 @@ msgid "" msgstr "" #: ../../library/resource.rst:16 ../../library/resource.rst:104 -#: ../../library/resource.rst:180 ../../library/resource.rst:192 -#: ../../library/resource.rst:201 ../../library/resource.rst:210 -#: ../../library/resource.rst:220 ../../library/resource.rst:229 -#: ../../library/resource.rst:239 ../../library/resource.rst:252 -#: ../../library/resource.rst:260 ../../library/resource.rst:268 +#: ../../library/resource.rst:181 ../../library/resource.rst:193 +#: ../../library/resource.rst:202 ../../library/resource.rst:211 +#: ../../library/resource.rst:221 ../../library/resource.rst:230 +#: ../../library/resource.rst:241 ../../library/resource.rst:255 +#: ../../library/resource.rst:264 ../../library/resource.rst:273 msgid "Availability" msgstr "可用性" @@ -93,7 +93,7 @@ msgstr "" msgid "" "Sets new limits of consumption of *resource*. The *limits* argument must be " "a tuple ``(soft, hard)`` of two integers describing the new limits. A value " -"of :data:`~resource.RLIM_INFINITY` can be used to request a limit that is " +"of :const:`~resource.RLIM_INFINITY` can be used to request a limit that is " "unlimited." msgstr "" @@ -101,7 +101,7 @@ msgstr "" msgid "" "Raises :exc:`ValueError` if an invalid resource is specified, if the new " "soft limit exceeds the hard limit, or if a process tries to raise its hard " -"limit. Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard " +"limit. Specifying a limit of :const:`~resource.RLIM_INFINITY` when the hard " "or system limit for that resource is not unlimited will result in a :exc:" "`ValueError`. A process with the effective UID of super-user can request " "any valid limit value, including unlimited, but :exc:`ValueError` will still " @@ -115,7 +115,7 @@ msgid "" msgstr "" #: ../../library/resource.rst:81 -msgid "VxWorks only supports setting :data:`RLIMIT_NOFILE`." +msgid "VxWorks only supports setting :const:`RLIMIT_NOFILE`." msgstr "" #: ../../library/resource.rst:83 @@ -183,9 +183,10 @@ msgstr "" #: ../../library/resource.rst:129 msgid "" "The maximum amount of processor time (in seconds) that a process can use. If " -"this limit is exceeded, a :const:`SIGXCPU` signal is sent to the process. " -"(See the :mod:`signal` module documentation for information about how to " -"catch this signal and do something useful, e.g. flush open files to disk.)" +"this limit is exceeded, a :const:`~signal.SIGXCPU` signal is sent to the " +"process. (See the :mod:`signal` module documentation for information about " +"how to catch this signal and do something useful, e.g. flush open files to " +"disk.)" msgstr "" #: ../../library/resource.rst:137 @@ -224,45 +225,47 @@ msgid "The maximum address space which may be locked in memory." msgstr "" #: ../../library/resource.rst:178 -msgid "The largest area of mapped memory which the process may occupy." +msgid "" +"The largest area of mapped memory which the process may occupy. Usually an " +"alias of :const:`RLIMIT_AS`." msgstr "" -#: ../../library/resource.rst:185 +#: ../../library/resource.rst:186 msgid "" "The maximum area (in bytes) of address space which may be taken by the " "process." msgstr "" -#: ../../library/resource.rst:190 +#: ../../library/resource.rst:191 msgid "The number of bytes that can be allocated for POSIX message queues." msgstr "" -#: ../../library/resource.rst:199 +#: ../../library/resource.rst:200 msgid "The ceiling for the process's nice level (calculated as 20 - rlim_cur)." msgstr "" -#: ../../library/resource.rst:208 +#: ../../library/resource.rst:209 msgid "The ceiling of the real-time priority." msgstr "" -#: ../../library/resource.rst:217 +#: ../../library/resource.rst:218 msgid "" "The time limit (in microseconds) on CPU time that a process can spend under " "real-time scheduling without making a blocking syscall." msgstr "" -#: ../../library/resource.rst:227 +#: ../../library/resource.rst:228 msgid "The number of signals which the process may queue." msgstr "" -#: ../../library/resource.rst:235 +#: ../../library/resource.rst:237 msgid "" "The maximum size (in bytes) of socket buffer usage for this user. This " "limits the amount of network memory, and hence the amount of mbufs, that " "this user may hold at any time." msgstr "" -#: ../../library/resource.rst:245 +#: ../../library/resource.rst:248 msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " "by all of this user id's processes. This limit is enforced only if bit 1 of " @@ -271,23 +274,23 @@ msgid "" "this sysctl." msgstr "" -#: ../../library/resource.rst:258 +#: ../../library/resource.rst:262 msgid "The maximum number of pseudo-terminals created by this user id." msgstr "" -#: ../../library/resource.rst:266 +#: ../../library/resource.rst:271 msgid "The maximum number of kqueues this user id is allowed to create." msgstr "" -#: ../../library/resource.rst:273 +#: ../../library/resource.rst:279 msgid "Resource Usage" msgstr "" -#: ../../library/resource.rst:275 +#: ../../library/resource.rst:281 msgid "These functions are used to retrieve resource usage information:" msgstr "" -#: ../../library/resource.rst:280 +#: ../../library/resource.rst:286 msgid "" "This function returns an object that describes the resources consumed by " "either the current process or its children, as specified by the *who* " @@ -295,11 +298,11 @@ msgid "" "`!RUSAGE_\\*` constants described below." msgstr "" -#: ../../library/resource.rst:285 +#: ../../library/resource.rst:291 msgid "A simple example::" msgstr "一個簡單範例: ::" -#: ../../library/resource.rst:287 +#: ../../library/resource.rst:293 msgid "" "from resource import *\n" "import time\n" @@ -314,7 +317,7 @@ msgid "" "print(getrusage(RUSAGE_SELF))" msgstr "" -#: ../../library/resource.rst:299 +#: ../../library/resource.rst:305 msgid "" "The fields of the return value each describe how a particular system " "resource has been used, e.g. amount of time spent running is user mode or " @@ -323,15 +326,15 @@ msgid "" "is using." msgstr "" -#: ../../library/resource.rst:304 +#: ../../library/resource.rst:310 msgid "" "For backward compatibility, the return value is also accessible as a tuple " "of 16 elements." msgstr "" -#: ../../library/resource.rst:307 +#: ../../library/resource.rst:313 msgid "" -"The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are " +"The fields :attr:`!ru_utime` and :attr:`!ru_stime` of the return value are " "floating-point values representing the amount of time spent executing in " "user mode and the amount of time spent executing in system mode, " "respectively. The remaining values are integers. Consult the :manpage:" @@ -339,249 +342,249 @@ msgid "" "summary is presented here:" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Index" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Field" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Resource" msgstr "" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:322 msgid "``0``" msgstr "``0``" -#: ../../library/resource.rst:316 -msgid ":attr:`ru_utime`" -msgstr ":attr:`ru_utime`" +#: ../../library/resource.rst:322 +msgid ":attr:`!ru_utime`" +msgstr ":attr:`!ru_utime`" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:322 msgid "time in user mode (float seconds)" msgstr "" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:324 msgid "``1``" msgstr "``1``" -#: ../../library/resource.rst:318 -msgid ":attr:`ru_stime`" -msgstr ":attr:`ru_stime`" +#: ../../library/resource.rst:324 +msgid ":attr:`!ru_stime`" +msgstr ":attr:`!ru_stime`" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:324 msgid "time in system mode (float seconds)" msgstr "" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:326 msgid "``2``" msgstr "``2``" -#: ../../library/resource.rst:320 -msgid ":attr:`ru_maxrss`" -msgstr ":attr:`ru_maxrss`" +#: ../../library/resource.rst:326 +msgid ":attr:`!ru_maxrss`" +msgstr ":attr:`!ru_maxrss`" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:326 msgid "maximum resident set size" msgstr "" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:328 msgid "``3``" msgstr "``3``" -#: ../../library/resource.rst:322 -msgid ":attr:`ru_ixrss`" -msgstr ":attr:`ru_ixrss`" +#: ../../library/resource.rst:328 +msgid ":attr:`!ru_ixrss`" +msgstr ":attr:`!ru_ixrss`" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:328 msgid "shared memory size" msgstr "" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:330 msgid "``4``" msgstr "``4``" -#: ../../library/resource.rst:324 -msgid ":attr:`ru_idrss`" -msgstr ":attr:`ru_idrss`" +#: ../../library/resource.rst:330 +msgid ":attr:`!ru_idrss`" +msgstr ":attr:`!ru_idrss`" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:330 msgid "unshared memory size" msgstr "" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:332 msgid "``5``" msgstr "``5``" -#: ../../library/resource.rst:326 -msgid ":attr:`ru_isrss`" -msgstr ":attr:`ru_isrss`" +#: ../../library/resource.rst:332 +msgid ":attr:`!ru_isrss`" +msgstr ":attr:`!ru_isrss`" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:332 msgid "unshared stack size" msgstr "" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:334 msgid "``6``" msgstr "``6``" -#: ../../library/resource.rst:328 -msgid ":attr:`ru_minflt`" -msgstr ":attr:`ru_minflt`" +#: ../../library/resource.rst:334 +msgid ":attr:`!ru_minflt`" +msgstr ":attr:`!ru_minflt`" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:334 msgid "page faults not requiring I/O" msgstr "" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:336 msgid "``7``" msgstr "``7``" -#: ../../library/resource.rst:330 -msgid ":attr:`ru_majflt`" -msgstr ":attr:`ru_majflt`" +#: ../../library/resource.rst:336 +msgid ":attr:`!ru_majflt`" +msgstr ":attr:`!ru_majflt`" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:336 msgid "page faults requiring I/O" msgstr "" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:338 msgid "``8``" msgstr "``8``" -#: ../../library/resource.rst:332 -msgid ":attr:`ru_nswap`" -msgstr ":attr:`ru_nswap`" +#: ../../library/resource.rst:338 +msgid ":attr:`!ru_nswap`" +msgstr ":attr:`!ru_nswap`" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:338 msgid "number of swap outs" msgstr "" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:340 msgid "``9``" msgstr "``9``" -#: ../../library/resource.rst:334 -msgid ":attr:`ru_inblock`" -msgstr ":attr:`ru_inblock`" +#: ../../library/resource.rst:340 +msgid ":attr:`!ru_inblock`" +msgstr ":attr:`!ru_inblock`" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:340 msgid "block input operations" msgstr "" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:342 msgid "``10``" msgstr "``10``" -#: ../../library/resource.rst:336 -msgid ":attr:`ru_oublock`" -msgstr ":attr:`ru_oublock`" +#: ../../library/resource.rst:342 +msgid ":attr:`!ru_oublock`" +msgstr ":attr:`!ru_oublock`" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:342 msgid "block output operations" msgstr "" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:344 msgid "``11``" msgstr "``11``" -#: ../../library/resource.rst:338 -msgid ":attr:`ru_msgsnd`" -msgstr ":attr:`ru_msgsnd`" +#: ../../library/resource.rst:344 +msgid ":attr:`!ru_msgsnd`" +msgstr ":attr:`!ru_msgsnd`" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:344 msgid "messages sent" msgstr "" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:346 msgid "``12``" msgstr "``12``" -#: ../../library/resource.rst:340 -msgid ":attr:`ru_msgrcv`" -msgstr ":attr:`ru_msgrcv`" +#: ../../library/resource.rst:346 +msgid ":attr:`!ru_msgrcv`" +msgstr ":attr:`!ru_msgrcv`" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:346 msgid "messages received" msgstr "" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:348 msgid "``13``" msgstr "``13``" -#: ../../library/resource.rst:342 -msgid ":attr:`ru_nsignals`" -msgstr ":attr:`ru_nsignals`" +#: ../../library/resource.rst:348 +msgid ":attr:`!ru_nsignals`" +msgstr ":attr:`!ru_nsignals`" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:348 msgid "signals received" msgstr "" -#: ../../library/resource.rst:344 +#: ../../library/resource.rst:350 msgid "``14``" msgstr "``14``" -#: ../../library/resource.rst:344 -msgid ":attr:`ru_nvcsw`" -msgstr ":attr:`ru_nvcsw`" +#: ../../library/resource.rst:350 +msgid ":attr:`!ru_nvcsw`" +msgstr ":attr:`!ru_nvcsw`" -#: ../../library/resource.rst:344 +#: ../../library/resource.rst:350 msgid "voluntary context switches" msgstr "" -#: ../../library/resource.rst:346 +#: ../../library/resource.rst:352 msgid "``15``" msgstr "``15``" -#: ../../library/resource.rst:346 -msgid ":attr:`ru_nivcsw`" -msgstr ":attr:`ru_nivcsw`" +#: ../../library/resource.rst:352 +msgid ":attr:`!ru_nivcsw`" +msgstr ":attr:`!ru_nivcsw`" -#: ../../library/resource.rst:346 +#: ../../library/resource.rst:352 msgid "involuntary context switches" msgstr "" -#: ../../library/resource.rst:349 +#: ../../library/resource.rst:355 msgid "" "This function will raise a :exc:`ValueError` if an invalid *who* parameter " "is specified. It may also raise :exc:`error` exception in unusual " "circumstances." msgstr "" -#: ../../library/resource.rst:355 +#: ../../library/resource.rst:361 msgid "" "Returns the number of bytes in a system page. (This need not be the same as " "the hardware page size.)" msgstr "" -#: ../../library/resource.rst:358 +#: ../../library/resource.rst:364 msgid "" "The following :const:`!RUSAGE_\\*` symbols are passed to the :func:" "`getrusage` function to specify which processes information should be " "provided for." msgstr "" -#: ../../library/resource.rst:364 +#: ../../library/resource.rst:370 msgid "" "Pass to :func:`getrusage` to request resources consumed by the calling " "process, which is the sum of resources used by all threads in the process." msgstr "" -#: ../../library/resource.rst:370 +#: ../../library/resource.rst:376 msgid "" "Pass to :func:`getrusage` to request resources consumed by child processes " "of the calling process which have been terminated and waited for." msgstr "" -#: ../../library/resource.rst:376 +#: ../../library/resource.rst:382 msgid "" "Pass to :func:`getrusage` to request resources consumed by both the current " "process and child processes. May not be available on all systems." msgstr "" -#: ../../library/resource.rst:382 +#: ../../library/resource.rst:388 msgid "" "Pass to :func:`getrusage` to request resources consumed by the current " "thread. May not be available on all systems." diff --git a/library/select.po b/library/select.po index 9c6bd9622f..b2d6032182 100644 --- a/library/select.po +++ b/library/select.po @@ -848,7 +848,7 @@ msgstr "" #: ../../library/select.rst:585 msgid ":const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_READ` 和 :const:`KQ_FILTER_WRITE` 篩選旗標:" #: ../../library/select.rst:590 msgid ":const:`KQ_NOTE_LOWAT`" @@ -860,7 +860,7 @@ msgstr "" #: ../../library/select.rst:593 msgid ":const:`KQ_FILTER_VNODE` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_VNODE` 篩選旗標:" #: ../../library/select.rst:598 msgid ":const:`KQ_NOTE_DELETE`" @@ -920,7 +920,7 @@ msgstr "" #: ../../library/select.rst:613 msgid ":const:`KQ_FILTER_PROC` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_PROC` 篩選旗標:" #: ../../library/select.rst:618 msgid ":const:`KQ_NOTE_EXIT`" @@ -984,7 +984,7 @@ msgstr "" #: ../../library/select.rst:636 msgid ":const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):" -msgstr "" +msgstr ":const:`KQ_FILTER_NETDEV` 篩選旗標(macOS 上不可用):" #: ../../library/select.rst:641 msgid ":const:`KQ_NOTE_LINKUP`" diff --git a/library/selectors.po b/library/selectors.po index f2ff1211e8..485a946309 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -299,15 +299,15 @@ msgstr "" #: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." -msgstr "" +msgstr "基於 :func:`select.select` 的選擇器。" #: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." -msgstr "" +msgstr "基於 :func:`select.poll` 的選擇器。" #: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." -msgstr "" +msgstr "基於 :func:`select.epoll` 的選擇器。" #: ../../library/selectors.rst:222 msgid "" @@ -317,7 +317,7 @@ msgstr "" #: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." -msgstr "" +msgstr "基於 :func:`select.devpoll` 的選擇器。" #: ../../library/selectors.rst:231 msgid "" @@ -327,7 +327,7 @@ msgstr "" #: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." -msgstr "" +msgstr "基於 :func:`select.kqueue` 的選擇器。" #: ../../library/selectors.rst:242 msgid "" diff --git a/library/shutil.po b/library/shutil.po index 415d7fb6dd..98dbfece64 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -1141,6 +1141,12 @@ msgid "" ">>> make_archive(archive_name, 'gztar', root_dir)\n" "'/Users/tarek/myarchive.tar.gz'" msgstr "" +">>> from shutil import make_archive\n" +">>> import os\n" +">>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))\n" +">>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))\n" +">>> make_archive(archive_name, 'gztar', root_dir)\n" +"'/Users/tarek/myarchive.tar.gz'" #: ../../library/shutil.rst:824 msgid "The resulting archive contains:" diff --git a/library/signal.po b/library/signal.po index 1d05f6b606..3e5ac2df35 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-15 00:15+0000\n" +"POT-Creation-Date: 2025-10-21 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-" @@ -51,8 +51,8 @@ msgstr "" msgid "" "A handler for a particular signal, once set, remains installed until it is " "explicitly reset (Python emulates the BSD style interface regardless of the " -"underlying implementation), with the exception of the handler " -"for :const:`SIGCHLD`, which follows the underlying implementation." +"underlying implementation), with the exception of the handler for :const:" +"`SIGCHLD`, which follows the underlying implementation." msgstr "" "特定訊號的處理程式一旦被設定,就會一直被安裝,直到被明確地重設為止 (不管底層" "的實作為何,Python 皆模擬出 BSD 風格的介面),但 :const:`SIGCHLD` 的處理程式除" @@ -86,12 +86,12 @@ msgstr "" #: ../../library/signal.rst:42 msgid "" -"It makes little sense to catch synchronous errors like :const:`SIGFPE` " -"or :const:`SIGSEGV` that are caused by an invalid operation in C code. " -"Python will return from the signal handler to the C code, which is likely to " -"raise the same signal again, causing Python to apparently hang. From Python " -"3.3 onwards, you can use the :mod:`faulthandler` module to report on " -"synchronous errors." +"It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" +"const:`SIGSEGV` that are caused by an invalid operation in C code. Python " +"will return from the signal handler to the C code, which is likely to raise " +"the same signal again, causing Python to apparently hang. From Python 3.3 " +"onwards, you can use the :mod:`faulthandler` module to report on synchronous " +"errors." msgstr "" "捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" "同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" @@ -131,8 +131,8 @@ msgid "" "instead." msgstr "" "Python 訊號處理程式總是在主直譯器的主 Python 執行緒中執行,即使訊號是在另一個" -"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使" -"用 :mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" +"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使用 :" +"mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" #: ../../library/signal.rst:69 msgid "" @@ -146,22 +146,20 @@ msgstr "模組內容" #: ../../library/signal.rst:75 msgid "" -"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask " -"(:const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums ` " -"(:class:`Signals`, :class:`Handlers` and :class:`Sigmasks` " -"respectively). :func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` " -"and :func:`sigwait` functions return human-readable :class:`enums " -"` as :class:`Signals` objects." +"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" +"const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " +"constants listed below were turned into :class:`enums ` (:" +"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" +"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" +"`sigwait` functions return human-readable :class:`enums ` as :" +"class:`Signals` objects." msgstr "" "下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" -"罩 (sigmask)" -"(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:`SIG_SETMASK`)的相關常數" -"被轉換成 :class:`enums `\\ " -"(:class:`Signals`、:class:`Handlers` " -"和 :class:`Sigmasks`)。:func:`getsignal`、:func:`pthread_sigmask`、:func:`sigpending` " -"和 :func:`sigwait` 函式會回傳可被人類閱讀的\\ :class:`枚舉 `\\ " -"作為 :class:`Signals` 物件。" +"罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" +"`SIG_SETMASK`)的相關常數被轉換成 :class:`enums `\\ (:class:" +"`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" +"func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" +"人類閱讀的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" @@ -174,37 +172,39 @@ msgstr "SIG* 常數和 CTRL_* 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:95 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` " -"and :const:`SIG_IGN`." +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" +"`SIG_IGN`." msgstr "" ":const:`SIG_DFL` 和 :const:`SIG_IGN` 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:101 msgid "" -":class:`enum.IntEnum` collection the " -"constants :const:`SIG_BLOCK`, :const:`SIG_UNBLOCK` and :const:`SIG_SETMASK`." +":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" +"`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數" -"的 :class:`enum.IntEnum` 集合。" +":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數的 :" +"class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:103 ../../library/signal.rst:136 #: ../../library/signal.rst:142 ../../library/signal.rst:148 #: ../../library/signal.rst:154 ../../library/signal.rst:160 #: ../../library/signal.rst:166 ../../library/signal.rst:180 #: ../../library/signal.rst:198 ../../library/signal.rst:206 -#: ../../library/signal.rst:217 ../../library/signal.rst:232 -#: ../../library/signal.rst:238 ../../library/signal.rst:244 -#: ../../library/signal.rst:262 ../../library/signal.rst:272 -#: ../../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:563 -#: ../../library/signal.rst:605 ../../library/signal.rst:620 -#: ../../library/signal.rst:646 ../../library/signal.rst:666 +#: ../../library/signal.rst:212 ../../library/signal.rst:218 +#: ../../library/signal.rst:233 ../../library/signal.rst:248 +#: ../../library/signal.rst:254 ../../library/signal.rst:260 +#: ../../library/signal.rst:266 ../../library/signal.rst:272 +#: ../../library/signal.rst:290 ../../library/signal.rst:300 +#: ../../library/signal.rst:379 ../../library/signal.rst:418 +#: ../../library/signal.rst:442 ../../library/signal.rst:465 +#: ../../library/signal.rst:499 ../../library/signal.rst:529 +#: ../../library/signal.rst:536 ../../library/signal.rst:591 +#: ../../library/signal.rst:633 ../../library/signal.rst:648 +#: ../../library/signal.rst:673 ../../library/signal.rst:693 msgid "Availability" msgstr "可用性" -#: ../../library/signal.rst:105 ../../library/signal.rst:473 +#: ../../library/signal.rst:105 ../../library/signal.rst:501 msgid "" "See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " "for further information." @@ -224,8 +224,8 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" "這是兩種標準訊號處理選項之一;它會簡單地執行訊號的預設功能。例如,在大多數系" -"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出," -"而 :const:`SIGCHLD` 的預設動作是直接忽略。" +"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出,而 :const:" +"`SIGCHLD` 的預設動作是直接忽略。" #: ../../library/signal.rst:124 msgid "" @@ -307,10 +307,22 @@ msgid "Default action is to ignore the signal." msgstr "預設動作是忽略訊號。" #: ../../library/signal.rst:210 +msgid "Profiling timer expired." +msgstr "" + +#: ../../library/signal.rst:216 +msgid "Terminal quit signal." +msgstr "" + +#: ../../library/signal.rst:222 msgid "Segmentation fault: invalid memory reference." msgstr "記憶體區段錯誤 (segmentation fault):無效記憶體參照。" -#: ../../library/signal.rst:214 +#: ../../library/signal.rst:226 +msgid "Stop executing (cannot be caught or ignored)." +msgstr "停止執行(無法被捕捉或忽略)。" + +#: ../../library/signal.rst:230 msgid "" "Stack fault on coprocessor. The Linux kernel does not raise this signal: it " "can only be raised in user space." @@ -318,56 +330,62 @@ msgstr "" "輔助處理器 (coprocessor) 上的堆疊錯誤 (stack fault)。Linux 核心不會引發此訊" "號:它只能在使用者空間 (user space) 中引發。" -#: ../../library/signal.rst:219 +#: ../../library/signal.rst:235 msgid "" -"On architectures where the signal is available. See the man " -"page :manpage:`signal(7)` for further information." +"On architectures where the signal is available. See the man page :manpage:" +"`signal(7)` for further information." msgstr "" "在訊號可用的架構上。請參閱 :manpage:`signal(7)` 線上手冊以取得更多資訊。" -#: ../../library/signal.rst:226 +#: ../../library/signal.rst:242 msgid "Termination signal." msgstr "終止訊號。" -#: ../../library/signal.rst:230 +#: ../../library/signal.rst:246 msgid "User-defined signal 1." msgstr "使用者定義訊號 1。" -#: ../../library/signal.rst:236 +#: ../../library/signal.rst:252 msgid "User-defined signal 2." msgstr "使用者定義訊號 2。" -#: ../../library/signal.rst:242 +#: ../../library/signal.rst:258 +msgid "Virtual timer expired." +msgstr "" + +#: ../../library/signal.rst:264 msgid "Window resize signal." msgstr "視窗調整大小訊號。" -#: ../../library/signal.rst:248 +#: ../../library/signal.rst:270 +msgid "CPU time limit exceeded." +msgstr "" + +#: ../../library/signal.rst:276 msgid "" "All the signal numbers are defined symbolically. For example, the hangup " "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " -"Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is " -"in :manpage:`signal(7)`). Note that not all systems define the same set of " -"signal names; only those names defined by the system are defined by this " -"module." +"Unix man page for '``signal``' lists the existing signals (on some systems " +"this is :manpage:`signal(2)`, on others the list is in :manpage:" +"`signal(7)`). Note that not all systems define the same set of signal names; " +"only those names defined by the system are defined by this module." msgstr "" -"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義" -"為 :const:`signal.SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 " -"```` 中找到。Unix 線上手冊 ':c:func:`signal`' 列出了現有的訊號(在" -"某些系統上是 :manpage:`signal(2)`,在其他系統上是在 :manpage:`signal(7)` " -"中)。請注意,並非所有系統都會定義同一套訊號名稱;只有那些由系統所定義的名稱" -"才會由這個模組定義。" +"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義為 :const:`signal." +"SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 ```` 中找到。Unix " +"線上手冊 '``signal``' 列出了現有的訊號(在某些系統上是 :manpage:" +"`signal(2)`,在其他系統上是在 :manpage:`signal(7)` 中)。請注意,並非所有系統" +"都會定義同一套訊號名稱;只有那些由系統所定義的名稱才會由這個模組定義。" -#: ../../library/signal.rst:259 +#: ../../library/signal.rst:287 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能" -"與 :func:`os.kill` 搭配使用。" +"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能與 :func:`os." +"kill` 搭配使用。" -#: ../../library/signal.rst:269 +#: ../../library/signal.rst:297 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." @@ -375,26 +393,26 @@ msgstr "" "與 :kbd:`Ctrl+Break` 擊鍵事件相對應的訊號。此訊號只能與 :func:`os.kill` 搭配" "使用。" -#: ../../library/signal.rst:279 +#: ../../library/signal.rst:307 msgid "" -"One more than the number of the highest signal number. " -"Use :func:`valid_signals` to get valid signal numbers." +"One more than the number of the highest signal number. Use :func:" +"`valid_signals` to get valid signal numbers." msgstr "" "比最高編號訊號的編號多一。使用 :func:`valid_signals` 來取得有效的訊號編號。" -#: ../../library/signal.rst:285 +#: ../../library/signal.rst:313 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "即時減少間隔計時器 (interval timer),並在到期時送出 :const:`SIGALRM`。" -#: ../../library/signal.rst:291 +#: ../../library/signal.rst:319 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." msgstr "僅在執行行程時遞減間隔計時器,並在到期時傳送 SIGVTALRM。" -#: ../../library/signal.rst:297 +#: ../../library/signal.rst:325 msgid "" "Decrements interval timer both when the process executes and when the system " "is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this " @@ -405,19 +423,19 @@ msgstr "" "這個計時器通常用來分析 (profile) 應用程式在使用者空間與核心空間 (kernel " "space) 所花費的時間。SIGPROF 會在到期時傳送。" -#: ../../library/signal.rst:305 +#: ../../library/signal.rst:333 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被阻檔。" -#: ../../library/signal.rst:312 +#: ../../library/signal.rst:340 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被解除阻檔。" -#: ../../library/signal.rst:319 +#: ../../library/signal.rst:347 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." @@ -425,32 +443,32 @@ msgstr "" ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號遮罩 (signal mask) 要" "被取代。" -#: ../../library/signal.rst:325 +#: ../../library/signal.rst:353 msgid "The :mod:`signal` module defines one exception:" msgstr ":mod:`signal` 模組定義了一個例外:" -#: ../../library/signal.rst:329 +#: ../../library/signal.rst:357 msgid "" -"Raised to signal an error from the underlying :func:`setitimer` " -"or :func:`getitimer` implementation. Expect this error if an invalid " -"interval timer or a negative time is passed to :func:`setitimer`. This error " -"is a subtype of :exc:`OSError`." +"Raised to signal an error from the underlying :func:`setitimer` or :func:" +"`getitimer` implementation. Expect this error if an invalid interval timer " +"or a negative time is passed to :func:`setitimer`. This error is a subtype " +"of :exc:`OSError`." msgstr "" "當 :func:`setitimer` 或 :func:`getitimer` 底層實作發生錯誤時引發訊號。如果傳" "給 :func:`setitimer` 的是無效的間隔計時器或負數時間,則預期會發生此錯誤。這個" "錯誤是 :exc:`OSError` 的子型別。" -#: ../../library/signal.rst:334 +#: ../../library/signal.rst:362 msgid "" -"This error used to be a subtype of :exc:`IOError`, which is now an alias " -"of :exc:`OSError`." +"This error used to be a subtype of :exc:`IOError`, which is now an alias of :" +"exc:`OSError`." msgstr "此錯誤過去是 :exc:`IOError` 的子型別,現在是 :exc:`OSError` 的別名。" -#: ../../library/signal.rst:339 +#: ../../library/signal.rst:367 msgid "The :mod:`signal` module defines the following functions:" msgstr ":mod:`signal` 模組定義了下列函式:" -#: ../../library/signal.rst:344 +#: ../../library/signal.rst:372 msgid "" "If *time* is non-zero, this function requests that a :const:`SIGALRM` signal " "be sent to the process in *time* seconds. Any previously scheduled alarm is " @@ -466,37 +484,37 @@ msgstr "" "則不會去排程任何警報,且已排程的警報會被取消。如果回傳值為零,則代表目前未排" "程任何警報。" -#: ../../library/signal.rst:353 +#: ../../library/signal.rst:381 msgid "See the man page :manpage:`alarm(2)` for further information." msgstr "更多資訊請見 :manpage:`alarm(2)` 線上手冊。" -#: ../../library/signal.rst:358 +#: ../../library/signal.rst:386 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " -"value may be a callable Python object, or one of the special " -"values :const:`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. " -"Here, :const:`signal.SIG_IGN` means that the signal was previously " -"ignored, :const:`signal.SIG_DFL` means that the default way of handling the " -"signal was previously in use, and ``None`` means that the previous signal " -"handler was not installed from Python." +"value may be a callable Python object, or one of the special values :const:" +"`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. Here, :const:" +"`signal.SIG_IGN` means that the signal was previously ignored, :const:" +"`signal.SIG_DFL` means that the default way of handling the signal was " +"previously in use, and ``None`` means that the previous signal handler was " +"not installed from Python." msgstr "" "回傳訊號 *signalnum* 的目前訊號處理程式。回傳值可以是一個可呼叫的 Python 物" -"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` " -"或 :const:`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽" -"略,:const:`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示" -"先前的訊號處理程式並未從 Python 安裝。" +"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` 或 :const:" +"`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽略,:const:" +"`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示先前的訊號處" +"理程式並未從 Python 安裝。" -#: ../../library/signal.rst:369 +#: ../../library/signal.rst:397 msgid "" -"Returns the description of signal *signalnum*, such as \"Interrupt\" " -"for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no " -"description. Raises :exc:`ValueError` if *signalnum* is invalid." +"Returns the description of signal *signalnum*, such as \"Interrupt\" for :" +"const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " +"Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" "回傳訊號 *signalnum* 的描述,例如 :const:`SIGINT` 的 \"Interrupt\"。如果 " -"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引" -"發 :exc:`ValueError`。" +"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引發 :" +"exc:`ValueError`。" -#: ../../library/signal.rst:378 +#: ../../library/signal.rst:406 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " @@ -505,29 +523,29 @@ msgstr "" "回傳此平台上的有效訊號編號集合。如果某些訊號被系統保留作為內部使用,則此值可" "能小於 ``range(1, NSIG)``。" -#: ../../library/signal.rst:387 +#: ../../library/signal.rst:415 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." msgstr "使行程休眠,直到接收到訊號;然後呼叫適當的處理程式。不會回傳任何東西。" -#: ../../library/signal.rst:392 +#: ../../library/signal.rst:420 msgid "See the man page :manpage:`signal(2)` for further information." msgstr "更多資訊請見 :manpage:`signal(2)` 線上手冊。" -#: ../../library/signal.rst:394 +#: ../../library/signal.rst:422 msgid "" -"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` " -"and :func:`sigpending`." +"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" +"func:`sigpending`." msgstr "" -"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` " -"和 :func:`sigpending`。" +"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` 和 :func:" +"`sigpending`。" -#: ../../library/signal.rst:400 +#: ../../library/signal.rst:428 msgid "Sends a signal to the calling process. Returns nothing." msgstr "傳送訊號至呼叫的行程。不會回傳任何東西。" -#: ../../library/signal.rst:407 +#: ../../library/signal.rst:435 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " @@ -537,11 +555,11 @@ msgstr "" "傳送訊號 *sig* 到檔案描述器 *pidfd* 所指的行程。Python 目前不支援 *siginfo* " "參數;它必須是 ``None``。*flags* 引數是提供給未來的擴充;目前沒有定義旗標值。" -#: ../../library/signal.rst:412 +#: ../../library/signal.rst:440 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 線上手冊。" -#: ../../library/signal.rst:420 +#: ../../library/signal.rst:448 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " "same process as the caller. The target thread can be executing any code " @@ -557,16 +575,16 @@ msgstr "" "`。因此,向特定 Python 執行緒發送訊號的唯一意義是強制執" "行中的系統呼叫以 :exc:`InterruptedError` 方式失敗。" -#: ../../library/signal.rst:428 +#: ../../library/signal.rst:456 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/signal.rst:432 +#: ../../library/signal.rst:460 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." @@ -574,7 +592,7 @@ msgstr "" "如果 *signalnum* 為 0,則不會傳送訊號,但仍會執行錯誤檢查;這可用來檢查目標執" "行緒是否仍在執行。" -#: ../../library/signal.rst:435 +#: ../../library/signal.rst:463 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." @@ -582,15 +600,15 @@ msgstr "" "引發一個附帶引數 ``thread_id``、``signalnum`` 的\\ :ref:`稽核事件 " "` ``signal.pthread_kill``。" -#: ../../library/signal.rst:439 +#: ../../library/signal.rst:467 msgid "See the man page :manpage:`pthread_kill(3)` for further information." msgstr "更多資訊請見 :manpage:`pthread_kill(3)` 線上手冊。" -#: ../../library/signal.rst:441 +#: ../../library/signal.rst:469 msgid "See also :func:`os.kill`." msgstr "另請參閱 :func:`os.kill`。" -#: ../../library/signal.rst:448 +#: ../../library/signal.rst:476 msgid "" "Fetch and/or change the signal mask of the calling thread. The signal mask " "is the set of signals whose delivery is currently blocked for the caller. " @@ -599,19 +617,19 @@ msgstr "" "擷取和/或變更呼叫執行緒的訊號遮罩。訊號遮罩是目前阻擋呼叫者傳送的訊號集合。將" "舊的訊號遮罩作為一組訊號集合回傳。" -#: ../../library/signal.rst:452 +#: ../../library/signal.rst:480 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." msgstr "呼叫的行為取決於 *how* 的值,如下所示。" -#: ../../library/signal.rst:454 +#: ../../library/signal.rst:482 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" ":data:`SIG_BLOCK`:被阻檔的訊號集合是目前訊號集合與 *mask* 引數的聯集。" -#: ../../library/signal.rst:456 +#: ../../library/signal.rst:484 msgid "" ":data:`SIG_UNBLOCK`: The signals in *mask* are removed from the current set " "of blocked signals. It is permissible to attempt to unblock a signal which " @@ -620,23 +638,23 @@ msgstr "" ":data:`SIG_UNBLOCK`:將 *mask* 中的訊號從目前阻檔的訊號集合中移除。嘗試為未被" "阻檔的訊號解除阻檔是允許的。" -#: ../../library/signal.rst:459 +#: ../../library/signal.rst:487 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." msgstr ":data:`SIG_SETMASK`:將被阻檔的訊號集合設定為 *mask* 引數。" -#: ../../library/signal.rst:462 +#: ../../library/signal.rst:490 msgid "" -"*mask* is a set of signal numbers (e.g. " -"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`}). " -"Use :func:`~signal.valid_signals` for a full mask including all signals." +"*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" +"`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " +"including all signals." msgstr "" -"*mask* 是一組訊號編號(例如 " -"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`})的集合。使" -"用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮罩。" +"*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." +"SIGTERM`})的集合。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完" +"整遮罩。" -#: ../../library/signal.rst:466 +#: ../../library/signal.rst:494 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." @@ -644,59 +662,56 @@ msgstr "" "例如,``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` 會讀取呼叫執行緒的訊號" "遮罩。" -#: ../../library/signal.rst:469 +#: ../../library/signal.rst:497 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." msgstr ":data:`SIGKILL` 和 :data:`SIGSTOP` 不能被阻檔。" -#: ../../library/signal.rst:476 +#: ../../library/signal.rst:504 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`sigpending` 與 :func:`sigwait`。" -#: ../../library/signal.rst:483 +#: ../../library/signal.rst:511 msgid "" -"Sets given interval timer (one " -"of :const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL` " -"or :const:`signal.ITIMER_PROF`) specified by *which* to fire after *seconds* " -"(float is accepted, different from :func:`alarm`) and after that every " -"*interval* seconds (if *interval* is non-zero). The interval timer specified " -"by *which* can be cleared by setting *seconds* to zero." +"Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" +"`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " +"to fire after *seconds* (float is accepted, different from :func:`alarm`) " +"and after that every *interval* seconds (if *interval* is non-zero). The " +"interval timer specified by *which* can be cleared by setting *seconds* to " +"zero." msgstr "" -"設定由 *which* 指定的間隔計時器" -"(:const:`signal.ITIMER_REAL`、:const:`signal.ITIMER_VIRTUAL` " -"或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮點數," -"與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如果 " -"*interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清除" -"它。" +"設定由 *which* 指定的間隔計時器(:const:`signal.ITIMER_REAL`、:const:`signal." +"ITIMER_VIRTUAL` 或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮" +"點數,與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如" +"果 *interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清" +"除它。" -#: ../../library/signal.rst:490 +#: ../../library/signal.rst:518 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " -"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` " -"sends :const:`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will " -"deliver :const:`SIGPROF`." +"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" +"`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時" -"器;:const:`signal.ITIMER_REAL` 會傳" -"送 :const:`SIGALRM`,:const:`signal.ITIMER_VIRTUAL` 會傳" -"送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會傳" -"送 :const:`SIGPROF`。" +"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時器;:" +"const:`signal.ITIMER_REAL` 會傳送 :const:`SIGALRM`,:const:`signal." +"ITIMER_VIRTUAL` 會傳送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會" +"傳送 :const:`SIGPROF`。" -#: ../../library/signal.rst:496 +#: ../../library/signal.rst:524 msgid "The old values are returned as a tuple: (delay, interval)." msgstr "舊值會以一個元組回傳:(delay, interval)。" -#: ../../library/signal.rst:498 +#: ../../library/signal.rst:526 msgid "" -"Attempting to pass an invalid interval timer will cause " -"an :exc:`ItimerError`." +"Attempting to pass an invalid interval timer will cause an :exc:" +"`ItimerError`." msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" -#: ../../library/signal.rst:506 +#: ../../library/signal.rst:534 msgid "Returns current value of a given interval timer specified by *which*." msgstr "回傳由 *which* 指定之間隔計時器的目前值。" -#: ../../library/signal.rst:513 +#: ../../library/signal.rst:541 msgid "" "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 " @@ -710,7 +725,7 @@ msgstr "" "fd。這可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處" "理。" -#: ../../library/signal.rst:520 +#: ../../library/signal.rst:548 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, " @@ -721,7 +736,7 @@ msgstr "" "停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " "select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" -#: ../../library/signal.rst:525 ../../library/signal.rst:580 +#: ../../library/signal.rst:553 ../../library/signal.rst:608 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -731,7 +746,7 @@ msgstr "" "當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 `\\ 的主" "執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" -#: ../../library/signal.rst:530 +#: ../../library/signal.rst:558 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 " @@ -740,7 +755,7 @@ msgstr "" "使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" "喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" -#: ../../library/signal.rst:535 +#: ../../library/signal.rst:563 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 " @@ -756,7 +771,7 @@ msgstr "" "法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" "出到 stderr。" -#: ../../library/signal.rst:544 +#: ../../library/signal.rst:572 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 " @@ -770,15 +785,15 @@ msgstr "" "如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" "用者就不會被虛假的警告訊息所混淆。" -#: ../../library/signal.rst:551 +#: ../../library/signal.rst:579 msgid "On Windows, the function now also supports socket handles." msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" -#: ../../library/signal.rst:554 +#: ../../library/signal.rst:582 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:559 +#: ../../library/signal.rst:587 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " @@ -787,11 +802,11 @@ msgstr "" "改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" "號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:593 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" -#: ../../library/signal.rst:567 +#: ../../library/signal.rst:595 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" @@ -800,22 +815,21 @@ msgstr "" "請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" "siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" -#: ../../library/signal.rst:574 +#: ../../library/signal.rst:602 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 " "the special values :const:`signal.SIG_IGN` or :const:`signal.SIG_DFL`. The " -"previous signal handler will be returned (see the description " -"of :func:`getsignal` above). (See the Unix man page :manpage:`signal(2)` " -"for further information.)" +"previous signal handler will be returned (see the description of :func:" +"`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " +"information.)" msgstr "" "將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" -"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` " -"或 :const:`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上" -"面 :func:`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手" -"冊 :manpage:`signal(2)`)。" +"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` 或 :const:" +"`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上面 :func:" +"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :manpage:`signal(2)`)。" -#: ../../library/signal.rst:585 +#: ../../library/signal.rst:613 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 " @@ -826,22 +840,22 @@ msgstr "" "frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 `\\ 或 :mod:`inspect` 模組中的屬性描述)。" -#: ../../library/signal.rst:590 +#: ../../library/signal.rst:618 msgid "" -"On Windows, :func:`signal` can only be called " -"with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, " -"or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. " -"Note that not all systems define the same set of signal names; " +"On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" +"`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" +"`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any " +"other case. Note that not all systems define the same set of signal names; " "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" -"在 Windows 上,:func:`signal` 只能在使" -"用 :const:`SIGABRT`、:const:`SIGFPE`、:const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` " -"或 :const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並" -"非所有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常" -"數,則會引發 :exc:`AttributeError` 錯誤。" +"在 Windows 上,:func:`signal` 只能在使用 :const:`SIGABRT`、:const:`SIGFPE`、:" +"const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` 或 :" +"const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並非所" +"有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常數," +"則會引發 :exc:`AttributeError` 錯誤。" -#: ../../library/signal.rst:601 +#: ../../library/signal.rst:629 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 " @@ -850,15 +864,15 @@ msgstr "" "檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" "合。" -#: ../../library/signal.rst:607 +#: ../../library/signal.rst:635 msgid "See the man page :manpage:`sigpending(2)` for further information." msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" -#: ../../library/signal.rst:609 +#: ../../library/signal.rst:637 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:616 +#: ../../library/signal.rst:644 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 " @@ -868,55 +882,52 @@ msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" "號(將其從待定訊號清單中移除),並回傳訊號編號。" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:650 msgid "See the man page :manpage:`sigwait(3)` for further information." msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" -#: ../../library/signal.rst:624 +#: ../../library/signal.rst:652 msgid "" -"See " -"also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo` " -"and :func:`sigtimedwait`." +"See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" +"`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" -"另也請" -"見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:`sigwaitinfo` " -"和 :func:`sigtimedwait`。" +"另也請見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:" +"`sigwaitinfo` 和 :func:`sigtimedwait`。" -#: ../../library/signal.rst:632 +#: ../../library/signal.rst:660 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 " "signal and removes it from the pending list of signals. If one of the " "signals in *sigset* is already pending for the calling thread, the function " "will return immediately with information about that signal. The signal " -"handler is not called for the delivered signal. The function raises " -"an :exc:`InterruptedError` if it is interrupted by a signal that is not in " -"*sigset*." +"handler is not called for the delivered signal. The function raises an :exc:" +"`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。該函式接受" "訊號,並將其從待定訊號清單中移除。如果 *sigset* 中的一個訊號已經是呼叫執行緒" "的待定訊號,函式會立即回傳該訊號的相關資訊。對於已傳送的訊號,訊號處理程式不" -"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引" -"發 :exc:`InterruptedError`。" +"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引發 :exc:" +"`InterruptedError`。" -#: ../../library/signal.rst:641 +#: ../../library/signal.rst:669 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:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:`si_band`." +"The return value is an object representing the data contained in the " +"``siginfo_t`` structure, namely: ``si_signo``, ``si_code``, ``si_errno``, " +"``si_pid``, ``si_uid``, ``si_status``, ``si_band``." msgstr "" -"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料," -"即 :attr:`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:`si_uid`、:attr:`si_status`、:attr:`si_band`。" +"回傳值是一個物件,代表 ``siginfo_t`` 結構所包含的資料,即 ``si_signo``、``si_code``、``si_errno``、" +"``si_pid``、``si_uid``、``si_status``、``si_band``。" -#: ../../library/signal.rst:648 +#: ../../library/signal.rst:675 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" -#: ../../library/signal.rst:650 +#: ../../library/signal.rst:677 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:654 +#: ../../library/signal.rst:681 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 " @@ -925,7 +936,7 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" "式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:662 +#: ../../library/signal.rst:689 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " @@ -934,15 +945,15 @@ msgstr "" "類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " "*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" -#: ../../library/signal.rst:668 +#: ../../library/signal.rst:695 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" -#: ../../library/signal.rst:670 +#: ../../library/signal.rst:697 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:674 +#: ../../library/signal.rst:701 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 " @@ -951,11 +962,11 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" "新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:683 +#: ../../library/signal.rst:710 msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:685 +#: ../../library/signal.rst:712 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 " @@ -969,7 +980,7 @@ msgstr "" "無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," "警報訊號就會被送出,而處理程式會產生例外。 ::" -#: ../../library/signal.rst:692 +#: ../../library/signal.rst:719 msgid "" "import signal, os\n" "\n" @@ -1003,24 +1014,24 @@ msgstr "" "\n" "signal.alarm(0) # 停用警報" -#: ../../library/signal.rst:709 +#: ../../library/signal.rst:736 msgid "Note on SIGPIPE" msgstr "關於 SIGPIPE 的說明" -#: ../../library/signal.rst:711 +#: ../../library/signal.rst:738 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 standard output closes early. This results in an exception " -"like :code:`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, " -"wrap your entry point to catch this exception as follows::" +"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 " +"standard output closes early. This results in an exception like :code:" +"`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " +"entry point to catch this exception as follows::" msgstr "" "將程式的輸出管道化到 :manpage:`head(1)` 之類的工具,會在你的行程的標準輸出接" -"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類" -"似 :code:`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請" -"將你的進入點包裝成如下的樣子來捕捉這個例外: ::" +"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類似 :code:" +"`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請將你的進" +"入點包裝成如下的樣子來捕捉這個例外: ::" -#: ../../library/signal.rst:717 +#: ../../library/signal.rst:744 msgid "" "import os\n" "import sys\n" @@ -1065,7 +1076,7 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/signal.rst:738 +#: ../../library/signal.rst:765 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 " @@ -1076,11 +1087,11 @@ msgstr "" "(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " "連線時被中斷而意外退出。" -#: ../../library/signal.rst:747 +#: ../../library/signal.rst:774 msgid "Note on Signal Handlers and Exceptions" msgstr "訊號處理程式與例外的說明" -#: ../../library/signal.rst:749 +#: ../../library/signal.rst:776 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. " @@ -1092,15 +1103,15 @@ msgid "" msgstr "" "如果訊號處理程式產生例外,例外會傳送到主執行緒並可能在任何 :term:`bytecode` " "指令之後發生。最值得注意的是,:exc:`KeyboardInterrupt` 可能在執行過程中的任何" -"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因" -"此 :exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在" -"罕見的情況下使程式處於預期之外的狀態。" +"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因此 :" +"exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在罕見" +"的情況下使程式處於預期之外的狀態。" -#: ../../library/signal.rst:756 +#: ../../library/signal.rst:783 msgid "To illustrate this issue, consider the following code::" msgstr "為了說明這個問題,請參考以下程式碼: ::" -#: ../../library/signal.rst:758 +#: ../../library/signal.rst:785 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -1132,11 +1143,11 @@ msgstr "" " ...\n" " self.lock.release()" -#: ../../library/signal.rst:773 +#: ../../library/signal.rst:800 msgid "" -"For many programs, especially those that merely want to exit " -"on :exc:`KeyboardInterrupt`, this is not a problem, but applications that " -"are complex or require high reliability should avoid raising exceptions from " +"For many programs, especially those that merely want to exit on :exc:" +"`KeyboardInterrupt`, this is not a problem, but applications that are " +"complex or require high reliability should avoid raising exceptions from " "signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " "a means of gracefully shutting down. Instead, they should install their " "own :const:`SIGINT` handler. Below is an example of an HTTP server that " @@ -1145,11 +1156,11 @@ msgstr "" "對許多程式來說,尤其是那些只想在 :exc:`KeyboardInterrupt` 時退出的程式,這並" "不是問題,但是對於複雜或需要高可靠性的應用程式來說,應該避免從訊號處理程式產" "生例外。它們也應該避免將捕獲 :exc:`KeyboardInterrupt` 作為一種優雅關閉 " -"(gracefully shutting down) 的方式。相反地,它們應該安裝自己" -"的 :const:`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` " -"的範例: ::" +"(gracefully shutting down) 的方式。相反地,它們應該安裝自己的 :const:" +"`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` 的範" +"例: ::" -#: ../../library/signal.rst:781 +#: ../../library/signal.rst:808 msgid "" "import signal\n" "import socket\n" diff --git a/library/smtplib.po b/library/smtplib.po index e16d62ed9d..71c0f0c5d6 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-12 00:13+0000\n" +"POT-Creation-Date: 2025-10-15 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-" @@ -125,17 +125,17 @@ msgstr "" msgid "" "An :class:`SMTP_SSL` instance behaves exactly the same as instances of :" "class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is " -"required from the beginning of the connection and using :meth:`starttls` is " -"not appropriate. If *host* is not specified, the local host is used. If " -"*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional " -"arguments *local_hostname*, *timeout* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. *context*, also optional, " -"can contain a :class:`~ssl.SSLContext` and allows configuring various " -"aspects of the secure connection. Please read :ref:`ssl-security` for best " -"practices." +"required from the beginning of the connection and using :meth:`~SMTP." +"starttls` is not appropriate. If *host* is not specified, the local host is " +"used. If *port* is zero, the standard SMTP-over-SSL port (465) is used. The " +"optional arguments *local_hostname*, *timeout* and *source_address* have the " +"same meaning as they do in the :class:`SMTP` class. *context*, also " +"optional, can contain a :class:`~ssl.SSLContext` and allows configuring " +"various aspects of the secure connection. Please read :ref:`ssl-security` " +"for best practices." msgstr "" -#: ../../library/smtplib.rst:92 ../../library/smtplib.rst:415 +#: ../../library/smtplib.rst:92 ../../library/smtplib.rst:424 msgid "*context* was added." msgstr "新增 *context*。" @@ -155,7 +155,7 @@ msgid "" "`ValueError` to prevent the creation of a non-blocking socket" msgstr "" -#: ../../library/smtplib.rst:107 ../../library/smtplib.rst:403 +#: ../../library/smtplib.rst:107 ../../library/smtplib.rst:412 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "" @@ -163,10 +163,10 @@ msgstr "" msgid "" "The LMTP protocol, which is very similar to ESMTP, is heavily based on the " "standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:" -"`connect` method must support that as well as a regular host:port server. " -"The optional arguments *local_hostname* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. To specify a Unix socket, you " -"must use an absolute path for *host*, starting with a '/'." +"`~SMTP.connect` method must support that as well as a regular host:port " +"server. The optional arguments *local_hostname* and *source_address* have " +"the same meaning as they do in the :class:`SMTP` class. To specify a Unix " +"socket, you must use an absolute path for *host*, starting with a '/'." msgstr "" #: ../../library/smtplib.rst:120 @@ -205,76 +205,86 @@ msgstr "" msgid "" "Base class for all exceptions that include an SMTP error code. These " "exceptions are generated in some instances when the SMTP server returns an " -"error code. The error code is stored in the :attr:`smtp_code` attribute of " -"the error, and the :attr:`smtp_error` attribute is set to the error message." +"error code." msgstr "" -#: ../../library/smtplib.rst:157 +#: ../../library/smtplib.rst:154 +msgid "The error code." +msgstr "" + +#: ../../library/smtplib.rst:158 +msgid "The error message." +msgstr "" + +#: ../../library/smtplib.rst:163 msgid "" "Sender address refused. In addition to the attributes set by on all :exc:" "`SMTPResponseException` exceptions, this sets 'sender' to the string that " "the SMTP server refused." msgstr "" -#: ../../library/smtplib.rst:164 +#: ../../library/smtplib.rst:170 +msgid "All recipient addresses refused." +msgstr "" + +#: ../../library/smtplib.rst:174 msgid "" -"All recipient addresses refused. The errors for each recipient are " -"accessible through the attribute :attr:`recipients`, which is a dictionary " -"of exactly the same sort as :meth:`SMTP.sendmail` returns." +"A dictionary of exactly the same sort as returned by :meth:`SMTP.sendmail` " +"containing the errors for each recipient." msgstr "" -#: ../../library/smtplib.rst:171 +#: ../../library/smtplib.rst:181 msgid "The SMTP server refused to accept the message data." msgstr "" -#: ../../library/smtplib.rst:176 +#: ../../library/smtplib.rst:186 msgid "Error occurred during establishment of a connection with the server." msgstr "" -#: ../../library/smtplib.rst:181 +#: ../../library/smtplib.rst:191 msgid "The server refused our ``HELO`` message." msgstr "" -#: ../../library/smtplib.rst:186 +#: ../../library/smtplib.rst:196 msgid "The command or option attempted is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:193 +#: ../../library/smtplib.rst:203 msgid "" "SMTP authentication went wrong. Most probably the server didn't accept the " "username/password combination provided." msgstr "" -#: ../../library/smtplib.rst:199 +#: ../../library/smtplib.rst:209 msgid ":rfc:`821` - Simple Mail Transfer Protocol" -msgstr "" +msgstr ":rfc:`821` - 簡易郵件傳輸協定" -#: ../../library/smtplib.rst:200 +#: ../../library/smtplib.rst:210 msgid "" "Protocol definition for SMTP. This document covers the model, operating " "procedure, and protocol details for SMTP." msgstr "" -#: ../../library/smtplib.rst:203 +#: ../../library/smtplib.rst:213 msgid ":rfc:`1869` - SMTP Service Extensions" msgstr "" -#: ../../library/smtplib.rst:204 +#: ../../library/smtplib.rst:214 msgid "" "Definition of the ESMTP extensions for SMTP. This describes a framework for " "extending SMTP with new commands, supporting dynamic discovery of the " "commands provided by the server, and defines a few additional commands." msgstr "" -#: ../../library/smtplib.rst:212 +#: ../../library/smtplib.rst:222 msgid "SMTP Objects" msgstr "SMTP 物件" -#: ../../library/smtplib.rst:214 +#: ../../library/smtplib.rst:224 msgid "An :class:`SMTP` instance has the following methods:" msgstr ":class:`SMTP` 實例擁有以下方法:" -#: ../../library/smtplib.rst:219 +#: ../../library/smtplib.rst:228 msgid "" "Set the debug output level. A value of 1 or ``True`` for *level* results in " "debug messages for connection and for all messages sent to and received from " @@ -282,36 +292,36 @@ msgid "" "timestamped." msgstr "" -#: ../../library/smtplib.rst:224 +#: ../../library/smtplib.rst:233 msgid "Added debuglevel 2." msgstr "" -#: ../../library/smtplib.rst:229 +#: ../../library/smtplib.rst:238 msgid "" "Send a command *cmd* to the server. The optional argument *args* is simply " "concatenated to the command, separated by a space." msgstr "" -#: ../../library/smtplib.rst:232 +#: ../../library/smtplib.rst:241 msgid "" "This returns a 2-tuple composed of a numeric response code and the actual " "response line (multiline responses are joined into one long line.)" msgstr "" -#: ../../library/smtplib.rst:235 +#: ../../library/smtplib.rst:244 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It is used to implement other methods and may be useful for " "testing private extensions." msgstr "" -#: ../../library/smtplib.rst:239 +#: ../../library/smtplib.rst:248 msgid "" "If the connection to the server is lost while waiting for the reply, :exc:" "`SMTPServerDisconnected` will be raised." msgstr "" -#: ../../library/smtplib.rst:245 +#: ../../library/smtplib.rst:254 msgid "" "Connect to a host on a given port. The defaults are to connect to the local " "host at the standard SMTP port (25). If the hostname ends with a colon " @@ -322,7 +332,7 @@ msgid "" "connection response." msgstr "" -#: ../../library/smtplib.rst:253 +#: ../../library/smtplib.rst:262 msgid "" "Raises an :ref:`auditing event ` ``smtplib.connect`` with " "arguments ``self``, ``host``, ``port``." @@ -330,7 +340,7 @@ msgstr "" "引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " "` ``smtplib.connect``。" -#: ../../library/smtplib.rst:258 +#: ../../library/smtplib.rst:267 msgid "" "Identify yourself to the SMTP server using ``HELO``. The hostname argument " "defaults to the fully qualified domain name of the local host. The message " @@ -338,14 +348,14 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:263 +#: ../../library/smtplib.rst:272 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It will be implicitly called by the :meth:`sendmail` when " "necessary." msgstr "" -#: ../../library/smtplib.rst:269 +#: ../../library/smtplib.rst:278 msgid "" "Identify yourself to an ESMTP server using ``EHLO``. The hostname argument " "defaults to the fully qualified domain name of the local host. Examine the " @@ -357,37 +367,37 @@ msgid "" "service extensions this server supports, and their parameters (if any)." msgstr "" -#: ../../library/smtplib.rst:279 +#: ../../library/smtplib.rst:288 msgid "" "Unless you wish to use :meth:`has_extn` before sending mail, it should not " "be necessary to call this method explicitly. It will be implicitly called " "by :meth:`sendmail` when necessary." msgstr "" -#: ../../library/smtplib.rst:285 +#: ../../library/smtplib.rst:294 msgid "" "This method calls :meth:`ehlo` and/or :meth:`helo` if there has been no " "previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` " "first." msgstr "" -#: ../../library/smtplib.rst:289 ../../library/smtplib.rst:318 -#: ../../library/smtplib.rst:406 ../../library/smtplib.rst:475 +#: ../../library/smtplib.rst:298 ../../library/smtplib.rst:327 +#: ../../library/smtplib.rst:415 ../../library/smtplib.rst:481 msgid ":exc:`SMTPHeloError`" msgstr ":exc:`SMTPHeloError`" -#: ../../library/smtplib.rst:290 ../../library/smtplib.rst:319 -#: ../../library/smtplib.rst:407 ../../library/smtplib.rst:476 +#: ../../library/smtplib.rst:299 ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:416 ../../library/smtplib.rst:482 msgid "The server didn't reply properly to the ``HELO`` greeting." msgstr "" -#: ../../library/smtplib.rst:294 +#: ../../library/smtplib.rst:303 msgid "" "Return :const:`True` if *name* is in the set of SMTP service extensions " "returned by the server, :const:`False` otherwise. Case is ignored." msgstr "" -#: ../../library/smtplib.rst:300 +#: ../../library/smtplib.rst:309 msgid "" "Check the validity of an address on this server using SMTP ``VRFY``. Returns " "a tuple consisting of code 250 and a full :rfc:`822` address (including " @@ -395,11 +405,11 @@ msgid "" "code of 400 or greater and an error string." msgstr "" -#: ../../library/smtplib.rst:307 +#: ../../library/smtplib.rst:316 msgid "Many sites disable SMTP ``VRFY`` in order to foil spammers." msgstr "" -#: ../../library/smtplib.rst:312 +#: ../../library/smtplib.rst:321 msgid "" "Log in on an SMTP server that requires authentication. The arguments are the " "username and the password to authenticate with. If there has been no " @@ -408,32 +418,32 @@ msgid "" "successful, or may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:321 +#: ../../library/smtplib.rst:330 msgid ":exc:`SMTPAuthenticationError`" msgstr ":exc:`SMTPAuthenticationError`" -#: ../../library/smtplib.rst:322 +#: ../../library/smtplib.rst:331 msgid "The server didn't accept the username/password combination." msgstr "" -#: ../../library/smtplib.rst:324 ../../library/smtplib.rst:409 -#: ../../library/smtplib.rst:485 +#: ../../library/smtplib.rst:333 ../../library/smtplib.rst:418 +#: ../../library/smtplib.rst:491 msgid ":exc:`SMTPNotSupportedError`" msgstr ":exc:`SMTPNotSupportedError`" -#: ../../library/smtplib.rst:325 +#: ../../library/smtplib.rst:334 msgid "The ``AUTH`` command is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:327 +#: ../../library/smtplib.rst:336 msgid ":exc:`SMTPException`" msgstr ":exc:`SMTPException`" -#: ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:337 msgid "No suitable authentication method was found." msgstr "" -#: ../../library/smtplib.rst:330 +#: ../../library/smtplib.rst:339 msgid "" "Each of the authentication methods supported by :mod:`smtplib` are tried in " "turn if they are advertised as supported by the server. See :meth:`auth` " @@ -441,7 +451,7 @@ msgid "" "passed through to :meth:`auth`." msgstr "" -#: ../../library/smtplib.rst:335 +#: ../../library/smtplib.rst:344 msgid "" "Optional keyword argument *initial_response_ok* specifies whether, for " "authentication methods that support it, an \"initial response\" as specified " @@ -449,35 +459,35 @@ msgid "" "requiring a challenge/response." msgstr "" -#: ../../library/smtplib.rst:340 +#: ../../library/smtplib.rst:349 msgid "" ":exc:`SMTPNotSupportedError` may be raised, and the *initial_response_ok* " "parameter was added." msgstr "" -#: ../../library/smtplib.rst:347 +#: ../../library/smtplib.rst:356 msgid "" "Issue an ``SMTP`` ``AUTH`` command for the specified authentication " "*mechanism*, and handle the challenge response via *authobject*." msgstr "" -#: ../../library/smtplib.rst:350 +#: ../../library/smtplib.rst:359 msgid "" "*mechanism* specifies which authentication mechanism is to be used as " "argument to the ``AUTH`` command; the valid values are those listed in the " "``auth`` element of :attr:`esmtp_features`." msgstr "" -#: ../../library/smtplib.rst:354 +#: ../../library/smtplib.rst:363 msgid "" "*authobject* must be a callable object taking an optional single argument::" msgstr "" -#: ../../library/smtplib.rst:356 +#: ../../library/smtplib.rst:365 msgid "data = authobject(challenge=None)" msgstr "data = authobject(challenge=None)" -#: ../../library/smtplib.rst:358 +#: ../../library/smtplib.rst:367 msgid "" "If optional keyword argument *initial_response_ok* is true, ``authobject()`` " "will be called first with no argument. It can return the :rfc:`4954` " @@ -488,7 +498,7 @@ msgid "" "false, then ``authobject()`` will not be called first with ``None``." msgstr "" -#: ../../library/smtplib.rst:366 +#: ../../library/smtplib.rst:375 msgid "" "If the initial response check returns ``None``, or if *initial_response_ok* " "is false, ``authobject()`` will be called to process the server's challenge " @@ -497,7 +507,7 @@ msgid "" "the server." msgstr "" -#: ../../library/smtplib.rst:372 +#: ../../library/smtplib.rst:381 msgid "" "The ``SMTP`` class provides ``authobjects`` for the ``CRAM-MD5``, ``PLAIN``, " "and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, ``SMTP." @@ -506,7 +516,7 @@ msgid "" "appropriate values." msgstr "" -#: ../../library/smtplib.rst:378 +#: ../../library/smtplib.rst:387 msgid "" "User code does not normally need to call ``auth`` directly, but can instead " "call the :meth:`login` method, which will try each of the above mechanisms " @@ -515,57 +525,57 @@ msgid "" "by :mod:`smtplib`." msgstr "" -#: ../../library/smtplib.rst:389 +#: ../../library/smtplib.rst:398 msgid "" "Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP " "commands that follow will be encrypted. You should then call :meth:`ehlo` " "again." msgstr "" -#: ../../library/smtplib.rst:393 +#: ../../library/smtplib.rst:402 msgid "" "If *keyfile* and *certfile* are provided, they are used to create an :class:" "`ssl.SSLContext`." msgstr "" -#: ../../library/smtplib.rst:396 +#: ../../library/smtplib.rst:405 msgid "" "Optional *context* parameter is an :class:`ssl.SSLContext` object; This is " "an alternative to using a keyfile and a certfile and if specified both " "*keyfile* and *certfile* should be ``None``." msgstr "" -#: ../../library/smtplib.rst:400 +#: ../../library/smtplib.rst:409 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first." msgstr "" -#: ../../library/smtplib.rst:410 +#: ../../library/smtplib.rst:419 msgid "The server does not support the STARTTLS extension." msgstr "" -#: ../../library/smtplib.rst:412 +#: ../../library/smtplib.rst:421 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../library/smtplib.rst:413 +#: ../../library/smtplib.rst:422 msgid "SSL/TLS support is not available to your Python interpreter." msgstr "" -#: ../../library/smtplib.rst:418 +#: ../../library/smtplib.rst:427 msgid "" -"The method now supports hostname check with :attr:`SSLContext." +"The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indicator* (see :const:`~ssl.HAS_SNI`)." msgstr "" -#: ../../library/smtplib.rst:423 +#: ../../library/smtplib.rst:432 msgid "" "The error raised for lack of STARTTLS support is now the :exc:" "`SMTPNotSupportedError` subclass instead of the base :exc:`SMTPException`." msgstr "" -#: ../../library/smtplib.rst:431 +#: ../../library/smtplib.rst:440 msgid "" "Send mail. The required arguments are an :rfc:`822` from-address string, a " "list of :rfc:`822` to-address strings (a bare string will be treated as a " @@ -574,18 +584,18 @@ msgid "" "*mail_options*. ESMTP options (such as ``DSN`` commands) that should be used " "with all ``RCPT`` commands can be passed as *rcpt_options*. (If you need to " "use different ESMTP options to different recipients you have to use the low-" -"level methods such as :meth:`mail`, :meth:`rcpt` and :meth:`data` to send " +"level methods such as :meth:`!mail`, :meth:`!rcpt` and :meth:`!data` to send " "the message.)" msgstr "" -#: ../../library/smtplib.rst:442 +#: ../../library/smtplib.rst:451 msgid "" "The *from_addr* and *to_addrs* parameters are used to construct the message " "envelope used by the transport agents. ``sendmail`` does not modify the " "message headers in any way." msgstr "" -#: ../../library/smtplib.rst:446 +#: ../../library/smtplib.rst:455 msgid "" "*msg* may be a string containing characters in the ASCII range, or a byte " "string. A string is encoded to bytes using the ascii codec, and lone " @@ -593,7 +603,7 @@ msgid "" "byte string is not modified." msgstr "" -#: ../../library/smtplib.rst:451 +#: ../../library/smtplib.rst:460 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first. If the server does ESMTP, message " @@ -602,7 +612,7 @@ msgid "" "will be tried and ESMTP options suppressed." msgstr "" -#: ../../library/smtplib.rst:457 +#: ../../library/smtplib.rst:466 msgid "" "This method will return normally if the mail is accepted for at least one " "recipient. Otherwise it will raise an exception. That is, if this method " @@ -612,69 +622,65 @@ msgid "" "SMTP error code and the accompanying error message sent by the server." msgstr "" -#: ../../library/smtplib.rst:464 +#: ../../library/smtplib.rst:473 msgid "" "If ``SMTPUTF8`` is included in *mail_options*, and the server supports it, " "*from_addr* and *to_addrs* may contain non-ASCII characters." msgstr "" -#: ../../library/smtplib.rst:467 +#: ../../library/smtplib.rst:476 msgid "This method may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:469 +#: ../../library/smtplib.rst:478 msgid ":exc:`SMTPRecipientsRefused`" msgstr ":exc:`SMTPRecipientsRefused`" -#: ../../library/smtplib.rst:470 -msgid "" -"All recipients were refused. Nobody got the mail. The :attr:`recipients` " -"attribute of the exception object is a dictionary with information about the " -"refused recipients (like the one returned when at least one recipient was " -"accepted)." +#: ../../library/smtplib.rst:479 +msgid "All recipients were refused. Nobody got the mail." msgstr "" -#: ../../library/smtplib.rst:478 +#: ../../library/smtplib.rst:484 msgid ":exc:`SMTPSenderRefused`" msgstr ":exc:`SMTPSenderRefused`" -#: ../../library/smtplib.rst:479 +#: ../../library/smtplib.rst:485 msgid "The server didn't accept the *from_addr*." msgstr "" -#: ../../library/smtplib.rst:481 +#: ../../library/smtplib.rst:487 msgid ":exc:`SMTPDataError`" msgstr ":exc:`SMTPDataError`" -#: ../../library/smtplib.rst:482 +#: ../../library/smtplib.rst:488 msgid "" "The server replied with an unexpected error code (other than a refusal of a " "recipient)." msgstr "" -#: ../../library/smtplib.rst:486 +#: ../../library/smtplib.rst:492 msgid "" "``SMTPUTF8`` was given in the *mail_options* but is not supported by the " "server." msgstr "" -#: ../../library/smtplib.rst:489 +#: ../../library/smtplib.rst:495 msgid "" "Unless otherwise noted, the connection will be open even after an exception " "is raised." msgstr "" -#: ../../library/smtplib.rst:492 +#: ../../library/smtplib.rst:498 msgid "*msg* may be a byte string." msgstr "" -#: ../../library/smtplib.rst:495 +#: ../../library/smtplib.rst:501 msgid "" "``SMTPUTF8`` support added, and :exc:`SMTPNotSupportedError` may be raised " "if ``SMTPUTF8`` is specified but the server does not support it." msgstr "" -#: ../../library/smtplib.rst:503 +#: ../../library/smtplib.rst:509 msgid "" "This is a convenience method for calling :meth:`sendmail` with the message " "represented by an :class:`email.message.Message` object. The arguments have " @@ -682,7 +688,7 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:508 +#: ../../library/smtplib.rst:514 msgid "" "If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills " "those arguments with addresses extracted from the headers of *msg* as " @@ -697,7 +703,7 @@ msgid "" "most recent set of :mailheader:`Resent-` headers." msgstr "" -#: ../../library/smtplib.rst:520 +#: ../../library/smtplib.rst:526 msgid "" "``send_message`` serializes *msg* using :class:`~email.generator." "BytesGenerator` with ``\\r\\n`` as the *linesep*, and calls :meth:`sendmail` " @@ -712,17 +718,17 @@ msgid "" "``BODY=8BITMIME`` are added to *mail_options*." msgstr "" -#: ../../library/smtplib.rst:534 +#: ../../library/smtplib.rst:540 msgid "Support for internationalized addresses (``SMTPUTF8``)." msgstr "" -#: ../../library/smtplib.rst:540 +#: ../../library/smtplib.rst:546 msgid "" "Terminate the SMTP session and close the connection. Return the result of " "the SMTP ``QUIT`` command." msgstr "" -#: ../../library/smtplib.rst:544 +#: ../../library/smtplib.rst:550 msgid "" "Low-level methods corresponding to the standard SMTP/ESMTP commands " "``HELP``, ``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also " @@ -730,11 +736,35 @@ msgid "" "documented here. For details, consult the module code." msgstr "" -#: ../../library/smtplib.rst:553 +#: ../../library/smtplib.rst:555 +msgid "Additionally, an SMTP instance has the following attributes:" +msgstr "此外,SMTP 實例擁有以下屬性:" + +#: ../../library/smtplib.rst:560 +msgid "The response to the ``HELO`` command, see :meth:`helo`." +msgstr "" + +#: ../../library/smtplib.rst:565 +msgid "The response to the ``EHLO`` command, see :meth:`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:570 +msgid "" +"A boolean value indicating whether the server supports ESMTP, see :meth:" +"`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:576 +msgid "" +"A dictionary of the names of SMTP service extensions supported by the " +"server, see :meth:`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:583 msgid "SMTP Example" msgstr "SMTP 範例" -#: ../../library/smtplib.rst:555 +#: ../../library/smtplib.rst:585 msgid "" "This example prompts the user for addresses needed in the message envelope " "('To' and 'From' addresses), and the message to be delivered. Note that the " @@ -744,7 +774,7 @@ msgid "" "headers explicitly::" msgstr "" -#: ../../library/smtplib.rst:561 +#: ../../library/smtplib.rst:591 msgid "" "import smtplib\n" "\n" @@ -774,7 +804,7 @@ msgid "" "server.quit()" msgstr "" -#: ../../library/smtplib.rst:590 +#: ../../library/smtplib.rst:620 msgid "" "In general, you will want to use the :mod:`email` package's features to " "construct an email message, which you can then send via :meth:`~smtplib.SMTP." @@ -791,4 +821,4 @@ msgstr "protocol(協定)" #: ../../library/smtplib.rst:11 msgid "Simple Mail Transfer Protocol" -msgstr "Simple Mail Transfer Protocol(簡單郵件傳輸協定)" +msgstr "Simple Mail Transfer Protocol(簡易郵件傳輸協定)" diff --git a/library/sqlite3.po b/library/sqlite3.po index 027f5d0432..644dd1f93b 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 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-" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described " -"by :pep:`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described by :pep:" +"`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -128,8 +128,8 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() " -"` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" msgstr "" #: ../../library/sqlite3.rst:93 @@ -142,8 +142,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by " -"calling :meth:`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" +"`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:106 @@ -155,9 +155,9 @@ msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) " -"`, assign the result to ``res``, and " -"call :meth:`res.fetchone() ` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " +"` to fetch the resulting row:" msgstr "" #: ../../library/sqlite3.rst:121 @@ -172,10 +172,9 @@ msgstr "" #: ../../library/sqlite3.rst:127 msgid "" -"We can see that the table has been created, as the query returns " -"a :class:`tuple` containing the table's name. If we query ``sqlite_master`` " -"for a non-existent table ``spam``, :meth:`!res.fetchone` will return " -"``None``:" +"We can see that the table has been created, as the query returns a :class:" +"`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" +"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" msgstr "" #: ../../library/sqlite3.rst:132 @@ -191,8 +190,8 @@ msgstr "" #: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " -"``INSERT`` statement, once again by calling :meth:`cur.execute(...) " -"`:" +"``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:142 @@ -213,8 +212,8 @@ msgstr "" msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() " -"` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" msgstr "" #: ../../library/sqlite3.rst:156 @@ -225,8 +224,8 @@ msgstr "con.commit()" msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() " -"` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" msgstr "" #: ../../library/sqlite3.rst:166 @@ -247,8 +246,8 @@ msgstr "" #: ../../library/sqlite3.rst:175 msgid "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) " -"`:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" msgstr "" #: ../../library/sqlite3.rst:178 @@ -304,10 +303,9 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by " -"calling :meth:`con.close() ` to close the existing " -"connection, opening a new one, creating a new cursor, then querying the " -"database:" +"Finally, verify that the database has been written to disk by calling :meth:" +"`con.close() ` to close the existing connection, opening a " +"new one, creating a new cursor, then querying the database:" msgstr "" #: ../../library/sqlite3.rst:216 @@ -396,9 +394,9 @@ msgstr "" #: ../../library/sqlite3.rst:277 msgid "" -"How many seconds the connection should wait before raising " -"an :exc:`OperationalError` when a table is locked. If another connection " -"opens a transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising an :exc:" +"`OperationalError` when a table is locked. If another connection opens a " +"transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" @@ -407,20 +405,19 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "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. By default (``0``), type " -"detection is disabled." +"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. By default (``0``), type detection is disabled." msgstr "" #: ../../library/sqlite3.rst:295 msgid "" -"Control legacy transaction handling behaviour. " -"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" -"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " -"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " -"transactions implicitly. Has no effect unless :attr:`Connection.autocommit` " -"is set to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." +"Control legacy transaction handling behaviour. See :attr:`Connection." +"isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " +"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " +"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " +"Has no effect unless :attr:`Connection.autocommit` is set to :const:" +"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" #: ../../library/sqlite3.rst:305 @@ -455,11 +452,11 @@ msgstr "" #: ../../library/sqlite3.rst:332 msgid "" -"Control :pep:`249` transaction handling behaviour. " -"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" -"autocommit` for more information. *autocommit* currently defaults " -"to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL`. The default will change to " -"``False`` in a future Python release." +"Control :pep:`249` transaction handling behaviour. See :attr:`Connection." +"autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " +"information. *autocommit* currently defaults to :const:`~sqlite3." +"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " +"future Python release." msgstr "" #: ../../library/sqlite3.rst:0 @@ -471,8 +468,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` " -"``sqlite3.connect``。" +"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." +"connect``。" #: ../../library/sqlite3.rst:344 msgid "" @@ -620,8 +617,8 @@ msgstr "" #: ../../library/sqlite3.rst:459 msgid "" -"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " -"Use :const:`!PARSE_COLNAMES` to enforce types for such queries." +"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 @@ -688,8 +685,8 @@ msgstr "" #: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` " -"of :class:`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` of :class:" +"`integers `." msgstr "" #: ../../library/sqlite3.rst:515 @@ -787,8 +784,8 @@ msgstr "" #: ../../library/sqlite3.rst:569 msgid "" -"These constants are used for the :meth:`Connection.setconfig` " -"and :meth:`~Connection.getconfig` methods." +"These constants are used for the :meth:`Connection.setconfig` and :meth:" +"`~Connection.getconfig` methods." msgstr "" #: ../../library/sqlite3.rst:572 @@ -816,9 +813,8 @@ msgstr "Connection 物件" #: ../../library/sqlite3.rst:592 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`." +"is created using :func:`sqlite3.connect`. Their main purpose is creating :" +"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" #: ../../library/sqlite3.rst:599 @@ -827,8 +823,8 @@ msgstr ":ref:`sqlite3-connection-shortcuts`" #: ../../library/sqlite3.rst:605 msgid "" -"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before " -"a :class:`!Connection` object is deleted." +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" +"class:`!Connection` object is deleted." msgstr "" #: ../../library/sqlite3.rst:608 @@ -838,9 +834,8 @@ msgstr "一個 SQLite 資料庫連線具有以下屬性和方法:" #: ../../library/sqlite3.rst:612 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." +"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:619 @@ -858,7 +853,7 @@ msgid "The name of the column where the blob is located." msgstr "" #: ../../library/sqlite3.rst:628 -msgid "The name of the row where the blob is located." +msgid "The row id where the blob is located." msgstr "" #: ../../library/sqlite3.rst:631 @@ -889,17 +884,17 @@ msgstr "" #: ../../library/sqlite3.rst:654 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. " -"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " -"if a pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. If :" +"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " +"pending transaction was committed by this method." msgstr "" #: ../../library/sqlite3.rst:662 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 :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " -"if a pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. If :" +"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " +"pending transaction was rolled back by this method." msgstr "" #: ../../library/sqlite3.rst:670 @@ -1270,17 +1265,17 @@ msgstr "" #: ../../library/sqlite3.rst:935 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`." +"executing on the connection. Aborted queries will raise an :exc:" +"`OperationalError`." msgstr "" #: ../../library/sqlite3.rst:942 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 " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " -"or :const:`SQLITE_IGNORE` to signal how access to the column should be " -"handled by the underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" +"`SQLITE_IGNORE` to signal how access to the column should be handled by the " +"underlying SQLite library." msgstr "" #: ../../library/sqlite3.rst:949 @@ -1352,11 +1347,10 @@ msgstr "" 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 " -"that the backend does not only run statements passed to " -"the :meth:`Cursor.execute` methods. Other sources include " -"the :ref:`transaction management ` of " -"the :mod:`!sqlite3` module and the execution of triggers defined in the " -"current database." +"that the backend does not only run statements passed to the :meth:`Cursor." +"execute` methods. Other sources include the :ref:`transaction management " +"` of the :mod:`!sqlite3` module and the " +"execution of triggers defined in the current database." msgstr "" #: ../../library/sqlite3.rst:1002 @@ -1390,8 +1384,8 @@ msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option " -"to :program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" +"program:`configure`." msgstr "" #: ../../library/sqlite3.rst:1035 @@ -1472,8 +1466,8 @@ msgstr "新增 *entrypoint* 參數。" #: ../../library/sqlite3.rst:1102 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." +"when saving an in-memory database for later restoration. Similar to the ``." +"dump`` command in the :program:`sqlite3` shell." msgstr "" #: ../../library/sqlite3.rst:1106 @@ -1600,8 +1594,8 @@ msgstr "" #: ../../library/sqlite3.rst:1214 msgid "" -"Example, query the maximum length of an SQL statement " -"for :class:`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement for :class:" +"`Connection` ``con`` (the default is 1000000000):" msgstr "" #: ../../library/sqlite3.rst:1224 @@ -1686,10 +1680,10 @@ msgstr "" #: ../../library/sqlite3.rst:1318 msgid "" -"Deserialize a :meth:`serialized ` database into " -"a :class:`Connection`. This method causes the database connection to " -"disconnect from database *name*, and reopen *name* as an in-memory database " -"based on the serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into a :class:" +"`Connection`. This method causes the database connection to disconnect from " +"database *name*, and reopen *name* as an in-memory database based on the " +"serialization contained in *data*." msgstr "" #: ../../library/sqlite3.rst:1324 @@ -1728,9 +1722,9 @@ msgstr "" #: ../../library/sqlite3.rst:1353 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." +"``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:1357 @@ -1739,8 +1733,8 @@ msgstr "" #: ../../library/sqlite3.rst:1359 msgid "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " -"and :meth:`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" +"`rollback` have no effect in this mode." msgstr "" #: ../../library/sqlite3.rst:1362 @@ -1765,8 +1759,8 @@ msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" #: ../../library/sqlite3.rst:1375 msgid "" -"The :attr:`isolation_level` attribute has no effect " -"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect unless :attr:" +"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" #: ../../library/sqlite3.rst:1382 @@ -1808,14 +1802,14 @@ msgstr "" #: ../../library/sqlite3.rst:1412 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect " -"the :attr:`!row_factory` of existing cursors belonging to this connection, " -"only new ones. Is ``None`` by default, meaning each row is returned as " -"a :class:`tuple`." +"from this connection. Assigning to this attribute does not affect the :attr:" +"`!row_factory` of existing cursors belonging to this connection, only new " +"ones. Is ``None`` by default, meaning each row is returned as a :class:" +"`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1705 -#: ../../library/sqlite3.rst:1728 +#: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1734 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" @@ -1844,15 +1838,15 @@ msgstr "Cursor 物件" 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 " -"created using :meth:`Connection.cursor`, or by using any of " -"the :ref:`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of the :ref:" +"`connection shortcut methods `." msgstr "" #: ../../library/sqlite3.rst:1448 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:" +"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:1459 @@ -1869,8 +1863,8 @@ msgstr ":class:`Cursor` 實例具有以下屬性和方法。" #: ../../library/sqlite3.rst:1480 msgid "" -"Execute a single SQL statement, optionally binding Python values " -"using :ref:`placeholders `." +"Execute a single SQL statement, optionally binding Python values using :ref:" +"`placeholders `." msgstr "" #: ../../library/sqlite3.rst:1484 @@ -1893,18 +1887,17 @@ msgstr "" #: ../../library/sqlite3.rst:1499 msgid "" -"If :attr:`~Connection.autocommit` " -"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " -"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " -"``REPLACE`` statement, and there is no open transaction, a transaction is " -"implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" +"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " +"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " +"transaction, a transaction is implicitly opened before executing *sql*." msgstr "" #: ../../library/sqlite3.rst:1508 msgid "" ":exc:`ProgrammingError` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of " -"a :class:`dict`." +"placeholders>` are used and *parameters* is a sequence instead of a :class:" +"`dict`." msgstr "" #: ../../library/sqlite3.rst:1512 @@ -1970,11 +1963,11 @@ msgstr "" #: ../../library/sqlite3.rst:1568 msgid "" -"Execute the SQL statements in *sql_script*. If " -"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " -"there is a pending transaction, an implicit ``COMMIT`` statement is executed " -"first. No other implicit transaction control is performed; any transaction " -"control must be added to *sql_script*." +"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." +"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " +"transaction, an implicit ``COMMIT`` statement is executed first. No other " +"implicit transaction control is performed; any transaction control must be " +"added to *sql_script*." msgstr "" #: ../../library/sqlite3.rst:1576 @@ -2030,44 +2023,52 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1617 +#: ../../library/sqlite3.rst:1615 +msgid "Negative *size* values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: ../../library/sqlite3.rst:1620 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:1624 +#: ../../library/sqlite3.rst:1627 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1626 +#: ../../library/sqlite3.rst:1629 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." +"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:1631 ../../library/sqlite3.rst:1635 +#: ../../library/sqlite3.rst:1634 ../../library/sqlite3.rst:1638 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1642 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." +"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:1644 +#: ../../library/sqlite3.rst:1645 +msgid "Negative values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: ../../library/sqlite3.rst:1650 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by " -"calling :meth:`con.cursor() ` will have " -"a :attr:`connection` attribute that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" +"`con.cursor() ` will have a :attr:`connection` attribute " +"that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1649 +#: ../../library/sqlite3.rst:1655 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2081,18 +2082,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1659 +#: ../../library/sqlite3.rst:1665 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:1663 +#: ../../library/sqlite3.rst:1669 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1667 +#: ../../library/sqlite3.rst:1673 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 " @@ -2102,15 +2103,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1675 +#: ../../library/sqlite3.rst:1681 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1677 +#: ../../library/sqlite3.rst:1683 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1682 +#: ../../library/sqlite3.rst:1688 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2120,7 +2121,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1693 +#: ../../library/sqlite3.rst:1699 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 " @@ -2129,61 +2130,61 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1706 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." +"Cursor` was created. Assigning to this attribute does not affect :attr:" +"`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1716 +#: ../../library/sqlite3.rst:1722 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1720 +#: ../../library/sqlite3.rst:1726 msgid "" -"A :class:`!Row` instance serves as a highly " -"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " -"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " -"access by column name and index." +"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." +"row_factory` for :class:`Connection` objects. It supports iteration, " +"equality testing, :func:`len`, and :term:`mapping` access by column name and " +"index." msgstr "" -#: ../../library/sqlite3.rst:1725 +#: ../../library/sqlite3.rst:1731 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1738 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`." +"Immediately after a query, it is the first member of each tuple in :attr:" +"`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1736 +#: ../../library/sqlite3.rst:1742 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1749 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1749 +#: ../../library/sqlite3.rst:1755 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:`len(blob) ` to get the size (number of bytes) of the blob. " -"Use indices and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" +"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " +"and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1754 +#: ../../library/sqlite3.rst:1760 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1757 +#: ../../library/sqlite3.rst:1763 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2205,37 +2206,37 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1785 +#: ../../library/sqlite3.rst:1791 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1787 +#: ../../library/sqlite3.rst:1793 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." +"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:1793 +#: ../../library/sqlite3.rst:1799 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)` " -"will be returned. When *length* is not specified, or is " -"negative, :meth:`~Blob.read` will read until the end of the blob." +"will be returned. When *length* is not specified, or is negative, :meth:" +"`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1801 +#: ../../library/sqlite3.rst:1807 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`." +"the blob length. Writing beyond the end of the blob will raise :exc:" +"`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1807 +#: ../../library/sqlite3.rst:1813 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1811 +#: ../../library/sqlite3.rst:1817 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2243,26 +2244,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1825 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1829 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:1831 +#: ../../library/sqlite3.rst:1837 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1833 +#: ../../library/sqlite3.rst:1839 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1837 +#: ../../library/sqlite3.rst:1843 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-" @@ -2270,39 +2271,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1844 +#: ../../library/sqlite3.rst:1850 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:1848 +#: ../../library/sqlite3.rst:1854 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1853 +#: ../../library/sqlite3.rst:1859 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1860 +#: ../../library/sqlite3.rst:1866 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1867 +#: ../../library/sqlite3.rst:1873 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:1874 +#: ../../library/sqlite3.rst:1880 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 " @@ -2310,14 +2311,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1881 +#: ../../library/sqlite3.rst:1887 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:1887 +#: ../../library/sqlite3.rst:1893 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 " @@ -2325,28 +2326,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1895 +#: ../../library/sqlite3.rst:1901 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:1900 +#: ../../library/sqlite3.rst:1906 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:1907 +#: ../../library/sqlite3.rst:1913 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 " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass " -"of :exc:`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" +"`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1914 +#: ../../library/sqlite3.rst:1920 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2355,78 +2356,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1930 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1932 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1929 +#: ../../library/sqlite3.rst:1935 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 +#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 +#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1959 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1959 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1944 ../../library/sqlite3.rst:1961 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1944 ../../library/sqlite3.rst:1961 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1940 +#: ../../library/sqlite3.rst:1946 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 +#: ../../library/sqlite3.rst:1946 ../../library/sqlite3.rst:1963 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1966 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1966 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1946 +#: ../../library/sqlite3.rst:1952 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1957 +#: ../../library/sqlite3.rst:1963 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1963 +#: ../../library/sqlite3.rst:1969 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 " @@ -2435,47 +2436,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1979 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1977 +#: ../../library/sqlite3.rst:1983 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:1981 +#: ../../library/sqlite3.rst:1987 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1983 +#: ../../library/sqlite3.rst:1989 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:1985 +#: ../../library/sqlite3.rst:1991 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:1987 +#: ../../library/sqlite3.rst:1993 msgid "" -"A converter for :ref:`declared ` \"date\" types " -"to :class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types to :" +"class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:1989 +#: ../../library/sqlite3.rst:1995 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:1995 +#: ../../library/sqlite3.rst:2001 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2483,42 +2484,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2008 +#: ../../library/sqlite3.rst:2014 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2016 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:2015 +#: ../../library/sqlite3.rst:2021 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2017 +#: ../../library/sqlite3.rst:2023 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2029 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2027 +#: ../../library/sqlite3.rst:2033 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2035 +#: ../../library/sqlite3.rst:2041 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2040 +#: ../../library/sqlite3.rst:2046 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2042 +#: ../../library/sqlite3.rst:2048 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 " @@ -2526,7 +2527,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2047 +#: ../../library/sqlite3.rst:2053 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2536,8 +2537,15 @@ msgid "" "SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" ">>> cur.execute(sql)" msgstr "" +">>> # 千萬不要這樣做,這不安全!\n" +">>> symbol = input()\n" +"' OR TRUE; --\n" +">>> sql = \"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol\n" +">>> print(sql)\n" +"SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" +">>> cur.execute(sql)" -#: ../../library/sqlite3.rst:2055 +#: ../../library/sqlite3.rst:2061 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 " @@ -2545,7 +2553,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2060 +#: ../../library/sqlite3.rst:2066 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, " @@ -2556,7 +2564,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2071 +#: ../../library/sqlite3.rst:2077 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2577,24 +2585,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2098 +#: ../../library/sqlite3.rst:2104 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2105 +#: ../../library/sqlite3.rst:2111 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2107 +#: ../../library/sqlite3.rst:2113 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:2111 +#: ../../library/sqlite3.rst:2117 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 " @@ -2604,11 +2612,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2123 +#: ../../library/sqlite3.rst:2129 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2125 +#: ../../library/sqlite3.rst:2131 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2618,7 +2626,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2133 +#: ../../library/sqlite3.rst:2139 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2650,18 +2658,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2157 +#: ../../library/sqlite3.rst:2163 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2159 +#: ../../library/sqlite3.rst:2165 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:2163 +#: ../../library/sqlite3.rst:2169 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2695,36 +2703,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2190 +#: ../../library/sqlite3.rst:2196 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2192 +#: ../../library/sqlite3.rst:2198 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:2197 +#: ../../library/sqlite3.rst:2203 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:2200 +#: ../../library/sqlite3.rst:2206 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:2205 +#: ../../library/sqlite3.rst:2211 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2208 +#: ../../library/sqlite3.rst:2214 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2734,32 +2742,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2214 +#: ../../library/sqlite3.rst:2220 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:2218 +#: ../../library/sqlite3.rst:2224 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2219 +#: ../../library/sqlite3.rst:2225 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2220 +#: ../../library/sqlite3.rst:2226 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " -"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." +"PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2224 +#: ../../library/sqlite3.rst:2230 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2226 +#: ../../library/sqlite3.rst:2232 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2801,15 +2809,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2277 +#: ../../library/sqlite3.rst:2283 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2279 +#: ../../library/sqlite3.rst:2285 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2281 +#: ../../library/sqlite3.rst:2287 msgid "" "import datetime\n" "import sqlite3\n" @@ -2847,23 +2855,23 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2341 +#: ../../library/sqlite3.rst:2347 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2343 +#: ../../library/sqlite3.rst:2349 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " -"and :meth:`~Connection.executescript` methods of the :class:`Connection` " -"class, your code can be written more concisely because you don't have to " -"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " -"the :class:`Cursor` objects are created implicitly and these shortcut " -"methods return the cursor objects. This way, you can execute a ``SELECT`` " -"statement and iterate over it directly using only a single call on " -"the :class:`Connection` object." +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" +"meth:`~Connection.executescript` methods of the :class:`Connection` class, " +"your code can be written more concisely because you don't have to create the " +"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" +"`Cursor` objects are created implicitly and these shortcut methods return " +"the cursor objects. This way, you can execute a ``SELECT`` statement and " +"iterate over it directly using only a single call on the :class:`Connection` " +"object." msgstr "" -#: ../../library/sqlite3.rst:2352 +#: ../../library/sqlite3.rst:2358 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2887,11 +2895,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2384 +#: ../../library/sqlite3.rst:2390 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2386 +#: ../../library/sqlite3.rst:2392 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2903,25 +2911,25 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2397 +#: ../../library/sqlite3.rst:2403 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:2402 +#: ../../library/sqlite3.rst:2408 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`." +"the connection. If you need a closing context manager, consider using :meth:" +"`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2406 +#: ../../library/sqlite3.rst:2412 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" -"\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " +"UNIQUE)\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -2941,19 +2949,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2436 +#: ../../library/sqlite3.rst:2442 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2438 +#: ../../library/sqlite3.rst:2444 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2440 +#: ../../library/sqlite3.rst:2446 msgid "Open a database in read-only mode:" msgstr "以唯讀模式開啟資料庫:" -#: ../../library/sqlite3.rst:2442 +#: ../../library/sqlite3.rst:2448 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2967,13 +2975,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2450 +#: ../../library/sqlite3.rst:2456 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:2453 +#: ../../library/sqlite3.rst:2459 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2983,11 +2991,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2460 +#: ../../library/sqlite3.rst:2466 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2462 +#: ../../library/sqlite3.rst:2468 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3013,32 +3021,32 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2482 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2485 +#: ../../library/sqlite3.rst:2491 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2487 +#: ../../library/sqlite3.rst:2493 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`." +"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:2492 +#: ../../library/sqlite3.rst:2498 msgid "" -"While :attr:`!row_factory` exists as an attribute both on " -"the :class:`Cursor` and the :class:`Connection`, it is recommended to " -"set :class:`Connection.row_factory`, so all cursors created from the " -"connection will use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on the :class:" +"`Cursor` and the :class:`Connection`, it is recommended to set :class:" +"`Connection.row_factory`, so all cursors created from the connection will " +"use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2497 +#: ../../library/sqlite3.rst:2503 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3046,7 +3054,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2508 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3054,11 +3062,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2513 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2509 +#: ../../library/sqlite3.rst:2515 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3073,7 +3081,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2525 +#: ../../library/sqlite3.rst:2531 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 " @@ -3081,13 +3089,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2530 +#: ../../library/sqlite3.rst:2536 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:2533 +#: ../../library/sqlite3.rst:2539 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3097,12 +3105,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2539 +#: ../../library/sqlite3.rst:2545 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2541 +#: ../../library/sqlite3.rst:2547 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3118,11 +3126,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2550 +#: ../../library/sqlite3.rst:2556 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2552 +#: ../../library/sqlite3.rst:2558 msgid "" "from collections import namedtuple\n" "\n" @@ -3138,11 +3146,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2561 +#: ../../library/sqlite3.rst:2567 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2563 +#: ../../library/sqlite3.rst:2569 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3168,69 +3176,69 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2577 +#: ../../library/sqlite3.rst:2583 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`." +"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:2585 +#: ../../library/sqlite3.rst:2591 msgid "How to handle non-UTF-8 text encodings" msgstr "如何處理非 UTF-8 的文字編碼" -#: ../../library/sqlite3.rst:2587 +#: ../../library/sqlite3.rst:2593 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 " -"fail for other encodings and invalid UTF-8. You can use a " -"custom :attr:`~Connection.text_factory` to handle such cases." +"fail for other encodings and invalid UTF-8. You can use a custom :attr:" +"`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2593 +#: ../../library/sqlite3.rst:2599 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 " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` " -"instance :py:data:`!con` connected to this database, we can decode the " -"Latin-2 encoded text using this :attr:`~Connection.text_factory`:" +"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" +"data:`!con` connected to this database, we can decode the Latin-2 encoded " +"text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2608 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2606 +#: ../../library/sqlite3.rst:2612 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:2609 +#: ../../library/sqlite3.rst:2615 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2615 +#: ../../library/sqlite3.rst:2621 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2620 +#: ../../library/sqlite3.rst:2626 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2626 +#: ../../library/sqlite3.rst:2632 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2632 +#: ../../library/sqlite3.rst:2638 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2640 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3238,123 +3246,122 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2643 +#: ../../library/sqlite3.rst:2649 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2645 +#: ../../library/sqlite3.rst:2651 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`." +"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:2650 +#: ../../library/sqlite3.rst:2656 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2654 +#: ../../library/sqlite3.rst:2660 msgid "" -":mod:`!sqlite3` ensures that a transaction is always open, " -"so :func:`connect`, :meth:`Connection.commit`, " -"and :meth:`Connection.rollback` will implicitly open a new transaction " -"(immediately after closing the pending one, for the latter two). :mod:`!" -"sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, so :func:" +"`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " +"implicitly open a new transaction (immediately after closing the pending " +"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " +"when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2665 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2666 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2661 +#: ../../library/sqlite3.rst:2667 msgid "" -"An implicit rollback is performed if the database " -"is :meth:`~Connection.close`-ed with pending changes." +"An implicit rollback is performed if the database is :meth:`~Connection." +"close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2664 +#: ../../library/sqlite3.rst:2670 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; " -"use :attr:`Connection.in_transaction` to query the low-level SQLite " -"autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." +"in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2672 +#: ../../library/sqlite3.rst:2678 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." +"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" +"ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2681 +#: ../../library/sqlite3.rst:2687 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2685 +#: ../../library/sqlite3.rst:2691 msgid "" -"The recommended way of controlling transactions is via " -"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" -"control-autocommit`." +"The recommended way of controlling transactions is via the :attr:" +"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" +"autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2689 +#: ../../library/sqlite3.rst:2695 msgid "" -"If :attr:`Connection.autocommit` is set " -"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " -"is controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set to :data:" +"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " +"controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2695 +#: ../../library/sqlite3.rst:2701 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened " -"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " -"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " -"statements, no implicit transaction handling is performed. Use " -"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " -"respectively commit and roll back pending transactions. You can choose the " -"underlying `SQLite transaction behaviour`_ — that is, whether and what type " -"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " -"the :attr:`~Connection.isolation_level` attribute." +"``None``, new transactions are implicitly opened before :meth:`~Cursor." +"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " +"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " +"transaction handling is performed. Use the :meth:`~Connection.commit` and :" +"meth:`~Connection.rollback` methods to respectively commit and roll back " +"pending transactions. You can choose the underlying `SQLite transaction " +"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" +"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " +"attribute." msgstr "" -#: ../../library/sqlite3.rst:2708 +#: ../../library/sqlite3.rst:2714 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using " -"the :attr:`~Connection.in_transaction` attribute." +"library autocommit mode can be queried using the :attr:`~Connection." +"in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2716 +#: ../../library/sqlite3.rst:2722 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:2720 +#: ../../library/sqlite3.rst:2726 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2724 +#: ../../library/sqlite3.rst:2730 msgid "" -"The recommended way of controlling transactions is now via " -"the :attr:`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via the :attr:" +"`~Connection.autocommit` attribute." msgstr "" #: ../../library/sqlite3.rst:1475 diff --git a/library/ssl.po b/library/ssl.po index 5939b968db..adc4b3823d 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-09-28 00:15+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-" @@ -59,7 +59,7 @@ msgstr "" "在使用此模組之前,請閱讀 :ref:`ssl-security`。如果不這樣做,可能會產生錯誤的" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" -#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 +#: ../../library/ssl.rst:455 ../../library/ssl.rst:470 #: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "可用性" @@ -228,7 +228,7 @@ msgid "" "purposes." msgstr "一個可以幫忙建立出 :class:`SSLContext` 物件以用於一般目的的方便函式。" -#: ../../library/ssl.rst:130 +#: ../../library/ssl.rst:131 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -238,7 +238,7 @@ msgstr "" "回傳一個新的 :class:`SSLContext` 物件,使用給定 *purpose* 的預設值。這些設定" "是由 :mod:`ssl` 選擇,通常比直接呼叫 :class:`SSLContext` 有更高的安全性。" -#: ../../library/ssl.rst:135 +#: ../../library/ssl.rst:136 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -252,7 +252,7 @@ msgstr "" # 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 +#: ../../library/ssl.rst:142 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -271,7 +271,7 @@ msgstr "" "個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." "load_default_certs` 。" -#: ../../library/ssl.rst:150 +#: ../../library/ssl.rst:151 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " @@ -281,7 +281,7 @@ msgstr "" "`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " "(logging)。" -#: ../../library/ssl.rst:154 +#: ../../library/ssl.rst:155 msgid "" "The default settings for this context include :data:" "`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " @@ -290,7 +290,7 @@ msgid "" "incompatibility with older X.509 certificates." msgstr "" -#: ../../library/ssl.rst:161 +#: ../../library/ssl.rst:162 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " @@ -299,7 +299,7 @@ msgstr "" "協定、選項、加密方式和其它設定可以在不捨棄舊值的情況下直接更改成新的值,這些" "值代表了在相容性和安全性之間取得的合理平衡。" -#: ../../library/ssl.rst:165 +#: ../../library/ssl.rst:166 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." @@ -307,7 +307,7 @@ msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" -#: ../../library/ssl.rst:169 +#: ../../library/ssl.rst:170 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -323,7 +323,7 @@ msgstr "" "SSL3.0 已經\\ `被完全破解 `_。如果你仍" "然希望在允許 SSL3.0 連線的情況下使用此函式,可以使用下面的方法: ::" -#: ../../library/ssl.rst:178 +#: ../../library/ssl.rst:179 msgid "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" @@ -331,7 +331,7 @@ msgstr "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" -#: ../../library/ssl.rst:182 +#: ../../library/ssl.rst:183 msgid "" "This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " "pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " @@ -339,7 +339,7 @@ msgid "" "recommended, you can do so using::" msgstr "" -#: ../../library/ssl.rst:187 +#: ../../library/ssl.rst:188 msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" @@ -347,23 +347,23 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../library/ssl.rst:194 +#: ../../library/ssl.rst:195 msgid "RC4 was dropped from the default cipher string." msgstr "把 RC4 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:198 +#: ../../library/ssl.rst:199 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "把 ChaCha20/Poly1305 加入預設加密方法字串。" -#: ../../library/ssl.rst:200 +#: ../../library/ssl.rst:201 msgid "3DES was dropped from the default cipher string." msgstr "把 3DES 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:204 +#: ../../library/ssl.rst:205 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支援。" -#: ../../library/ssl.rst:208 +#: ../../library/ssl.rst:209 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." @@ -371,17 +371,17 @@ msgstr "" "目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:214 +#: ../../library/ssl.rst:215 msgid "" "The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" "`VERIFY_X509_STRICT` in its default verify flags." msgstr "" -#: ../../library/ssl.rst:219 +#: ../../library/ssl.rst:220 msgid "Exceptions" msgstr "例外" -#: ../../library/ssl.rst:223 +#: ../../library/ssl.rst:224 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -395,11 +395,11 @@ msgstr "" "`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " "函式庫提供。" -#: ../../library/ssl.rst:230 +#: ../../library/ssl.rst:231 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr ":exc:`SSLError` 曾經是 :exc:`socket.error` 的一個子型別。" -#: ../../library/ssl.rst:235 +#: ../../library/ssl.rst:236 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " @@ -408,7 +408,7 @@ msgstr "" "一個字串符號 (string mnemonic),用來指定發生錯誤的 OpenSSL 子模組,如:" "``SSL``、``PEM`` 或 ``X509``。可能值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:243 +#: ../../library/ssl.rst:244 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " @@ -417,7 +417,7 @@ msgstr "" "一個字串符號,用來指定發生錯誤的原因,如:``CERTIFICATE_VERIFY_FAILED``。可能" "值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:251 +#: ../../library/ssl.rst:252 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " @@ -426,7 +426,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫已經被完全關閉的 SSL 連線時會被引" "發。請注意,這並不表示底層傳輸(例如 TCP)已經被關閉。" -#: ../../library/ssl.rst:259 +#: ../../library/ssl.rst:260 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -435,7 +435,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先接收更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:268 +#: ../../library/ssl.rst:269 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -444,7 +444,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先發送更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:277 +#: ../../library/ssl.rst:278 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " @@ -453,7 +453,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去操作 SSL socket 時有系統錯誤產生會引發" "此錯誤。不幸的是,目前沒有任何簡單的方法可以去檢查原本的的 errno 編號。" -#: ../../library/ssl.rst:285 +#: ../../library/ssl.rst:286 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " @@ -462,32 +462,32 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當 SSL 連線被突然終止時會引發此錯誤。通常,當" "此錯誤發生時,你不該再去重新使用底層傳輸。" -#: ../../library/ssl.rst:293 +#: ../../library/ssl.rst:294 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "當憑證驗證失敗時會引發的一個 :exc:`SSLError` 子類別。" -#: ../../library/ssl.rst:300 +#: ../../library/ssl.rst:301 msgid "A numeric error number that denotes the verification error." msgstr "一個表示驗證錯誤的錯誤數值編號。" -#: ../../library/ssl.rst:304 +#: ../../library/ssl.rst:305 msgid "A human readable string of the verification error." msgstr "一個人類可讀的驗證錯誤字串。" -#: ../../library/ssl.rst:308 +#: ../../library/ssl.rst:309 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr ":exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:310 +#: ../../library/ssl.rst:311 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "此例外現在是 :exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:315 +#: ../../library/ssl.rst:316 msgid "Random generation" msgstr "隨機產生" -#: ../../library/ssl.rst:319 +#: ../../library/ssl.rst:320 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 " @@ -500,11 +500,11 @@ msgstr "" "func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" "為 PRNG 設定隨機種子。" -#: ../../library/ssl.rst:325 +#: ../../library/ssl.rst:326 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "在幾乎所有的應用程式中,:func:`os.urandom` 會是較好的選擇。" -#: ../../library/ssl.rst:327 +#: ../../library/ssl.rst:328 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) `_\\ 文章來了" "解密碼學安全偽隨機數產生器的需求。" -#: ../../library/ssl.rst:336 +#: ../../library/ssl.rst:337 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " "with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." @@ -526,7 +526,7 @@ msgstr "" "``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" "`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" -#: ../../library/ssl.rst:343 +#: ../../library/ssl.rst:344 msgid "" "Mix the given *bytes* into the SSL pseudo-random number generator. The " "parameter *entropy* (a float) is a lower bound on the entropy contained in " @@ -537,15 +537,15 @@ msgstr "" "指字串中包含熵值的下限(因此你可以將其設為 ``0.0``\\ )。請參閱 :rfc:`1750` " "了解有關熵源的更多資訊。" -#: ../../library/ssl.rst:348 +#: ../../library/ssl.rst:349 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "可寫入的\\ :term:`類位元組物件 `\\ 現在可被接受。" -#: ../../library/ssl.rst:352 +#: ../../library/ssl.rst:353 msgid "Certificate handling" msgstr "認證處理" -#: ../../library/ssl.rst:360 +#: ../../library/ssl.rst:361 msgid "" "Return the time in seconds since the Epoch, given the ``cert_time`` string " "representing the \"notBefore\" or \"notAfter\" date from a certificate in " @@ -555,11 +555,11 @@ msgstr "" "\"notAfter\" 日期,字串採用 ``\"%b %d %H:%M:%S %Y %Z\"`` 格式(C 語言區域設" "定)。" -#: ../../library/ssl.rst:365 +#: ../../library/ssl.rst:366 msgid "Here's an example:" msgstr "以下是一個範例:" -#: ../../library/ssl.rst:367 +#: ../../library/ssl.rst:368 msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" @@ -577,11 +577,11 @@ msgstr "" ">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" -#: ../../library/ssl.rst:377 +#: ../../library/ssl.rst:378 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "\"notBefore\" 或 \"notAfter\" 日期必須使用 GMT (:rfc:`5280`)。" -#: ../../library/ssl.rst:379 +#: ../../library/ssl.rst:380 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " @@ -590,7 +590,7 @@ msgstr "" "將輸入的時間直譯為 UTC 時間,如輸入字串中指定的 'GMT' 時區。在之前是使用本地" "的時區。回傳一個整數(在輸入格式中不包括秒的小數部分)。" -#: ../../library/ssl.rst:388 +#: ../../library/ssl.rst:389 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -611,11 +611,11 @@ msgstr "" "組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " "參數指定超時時間。" -#: ../../library/ssl.rst:399 +#: ../../library/ssl.rst:400 msgid "This function is now IPv6-compatible." msgstr "此函式現在是與 IPv6 相容的。" -#: ../../library/ssl.rst:402 +#: ../../library/ssl.rst:403 msgid "" "The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" "`PROTOCOL_TLS` for maximum compatibility with modern servers." @@ -623,11 +623,11 @@ msgstr "" "預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" "`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" -#: ../../library/ssl.rst:406 +#: ../../library/ssl.rst:407 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/ssl.rst:411 +#: ../../library/ssl.rst:412 msgid "" "Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded " "string version of the same certificate." @@ -635,14 +635,14 @@ msgstr "" "給定一個以 DER 編碼的位元組 blob 作為憑證,回傳以 PEM 編碼字串版本的相同憑" "證。" -#: ../../library/ssl.rst:416 +#: ../../library/ssl.rst:417 msgid "" "Given a certificate as an ASCII PEM string, returns a DER-encoded sequence " "of bytes for that same certificate." msgstr "" "給定一個以 ASCII PEM 的字串作為憑證,回傳以 DER 編碼的位元組序列的相同憑證。" -#: ../../library/ssl.rst:421 +#: ../../library/ssl.rst:422 msgid "" "Returns a named tuple with paths to OpenSSL's default cafile and capath. The " "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " @@ -652,39 +652,39 @@ msgstr "" "meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" "`named tuple` ``DefaultVerifyPaths``:" -#: ../../library/ssl.rst:426 +#: ../../library/ssl.rst:427 msgid "" ":attr:`cafile` - resolved path to cafile or ``None`` if the file doesn't " "exist," msgstr ":attr:`cafile` - 解析後的 cafile 路徑,如果檔案不存在則為 ``None``," -#: ../../library/ssl.rst:427 +#: ../../library/ssl.rst:428 msgid "" ":attr:`capath` - resolved path to capath or ``None`` if the directory " "doesn't exist," msgstr ":attr:`capath` - 解析後的 capath 路徑,如果目錄不存在則為 ``None``," -#: ../../library/ssl.rst:428 +#: ../../library/ssl.rst:429 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," msgstr ":attr:`openssl_cafile_env` - 指向 cafile 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:429 +#: ../../library/ssl.rst:430 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr ":attr:`openssl_cafile` - hard coded 的 cafile 路徑," -#: ../../library/ssl.rst:430 +#: ../../library/ssl.rst:431 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," msgstr ":attr:`openssl_capath_env` - 指向 capath 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:431 +#: ../../library/ssl.rst:432 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" msgstr ":attr:`openssl_capath` - hard coded 的 capath 目錄路徑" -#: ../../library/ssl.rst:437 +#: ../../library/ssl.rst:438 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " @@ -693,7 +693,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋憑證。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:441 +#: ../../library/ssl.rst:442 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:" @@ -706,12 +706,12 @@ msgstr "" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" "組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" -#: ../../library/ssl.rst:448 ../../library/ssl.rst:1605 -#: ../../library/ssl.rst:1905 +#: ../../library/ssl.rst:449 ../../library/ssl.rst:1609 +#: ../../library/ssl.rst:1909 msgid "Example::" msgstr "範例: ::" -#: ../../library/ssl.rst:450 +#: ../../library/ssl.rst:451 msgid "" ">>> ssl.enum_certificates(\"CA\")\n" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" @@ -721,7 +721,7 @@ msgstr "" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" -#: ../../library/ssl.rst:460 +#: ../../library/ssl.rst:461 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." @@ -729,7 +729,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋 CRLs。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:464 +#: ../../library/ssl.rst:465 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:" @@ -739,18 +739,18 @@ msgstr "" "指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" -#: ../../library/ssl.rst:475 +#: ../../library/ssl.rst:476 msgid "Constants" msgstr "常數" -#: ../../library/ssl.rst:477 +#: ../../library/ssl.rst:478 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" "所有的常數現在都是 :class:`enum.IntEnum` 或 :class:`enum.IntFlag` 的集合。" -#: ../../library/ssl.rst:483 +#: ../../library/ssl.rst:484 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " @@ -761,7 +761,7 @@ msgstr "" "外,這是預設的模式。對於用戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," "像是不被信任或是過期的憑證,會被忽略並不會中止 TLS/SSL 握手。" -#: ../../library/ssl.rst:489 +#: ../../library/ssl.rst:490 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." @@ -769,11 +769,11 @@ msgstr "" "在伺服器模式下,不會從用戶端請求任何憑證,所以用戶端不用發送任何用於用戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:492 ../../library/ssl.rst:2407 +#: ../../library/ssl.rst:493 ../../library/ssl.rst:2411 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" -#: ../../library/ssl.rst:496 +#: ../../library/ssl.rst:497 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " @@ -783,7 +783,7 @@ msgstr "" "`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " "推薦改用 :const:`CERT_REQUIRED`。" -#: ../../library/ssl.rst:501 +#: ../../library/ssl.rst:502 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -795,7 +795,7 @@ msgstr "" "發送憑證來執行 TLS 用戶端憑證身分驗證。如果用戶端選擇發送憑證,則會對其進行驗" "證。任何驗證錯誤都會立刻終止 TLS 握手。" -#: ../../library/ssl.rst:507 ../../library/ssl.rst:526 +#: ../../library/ssl.rst:508 ../../library/ssl.rst:527 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." @@ -803,7 +803,7 @@ msgstr "" "使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." "load_verify_locations`。" -#: ../../library/ssl.rst:512 +#: ../../library/ssl.rst:513 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -821,7 +821,7 @@ msgstr "" "`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" "`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:522 +#: ../../library/ssl.rst:523 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " @@ -830,11 +830,11 @@ msgstr "" "對於 socket 伺服器,此模式會提供強制的 TLS 用戶端憑證驗證。用戶端憑證請求會被" "發送給用戶端並且用戶端必須提供有效且被信任的憑證。" -#: ../../library/ssl.rst:531 +#: ../../library/ssl.rst:532 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr ":class:`enum.IntEnum` 為 CERT_* 常數的一個集合。" -#: ../../library/ssl.rst:537 +#: ../../library/ssl.rst:538 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " @@ -843,7 +843,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,不會檢查憑證吊銷列表 " "(CRLs)。預設的 OpenSSL 並不會請求及驗證 CRLs。" -#: ../../library/ssl.rst:545 +#: ../../library/ssl.rst:546 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 " @@ -856,7 +856,7 @@ msgstr "" "效的 CRL 簽名。如果沒有用 :attr:`SSLContext.load_verify_locations` 載入適當" "的 CRL,則會驗證失敗。" -#: ../../library/ssl.rst:555 +#: ../../library/ssl.rst:556 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." @@ -864,7 +864,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,會檢查對等憑證鍊中所有" "憑證的 CRLs。" -#: ../../library/ssl.rst:562 +#: ../../library/ssl.rst:563 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." @@ -872,13 +872,13 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值,用來禁用已損壞的 X.509 憑證的解決方" "法。" -#: ../../library/ssl.rst:569 +#: ../../library/ssl.rst:570 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr ":attr:`SSLContext.verify_flags` 可能的值,用來啟用憑證代理驗證。" -#: ../../library/ssl.rst:576 +#: ../../library/ssl.rst:577 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " @@ -887,7 +887,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。它指示 OpenSSL 在構建信任鍊來驗證憑" "證時會優先使用被信任的憑證。此旗標預設開啟。" -#: ../../library/ssl.rst:584 +#: ../../library/ssl.rst:585 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -899,11 +899,11 @@ msgstr "" "間 CAs 作為信任錨,就像自簽名的根 CA 憑證。這樣就能去信任中間 CA 所頒發的憑" "證,而不一定非要去信任其祖先的根 CA。" -#: ../../library/ssl.rst:595 +#: ../../library/ssl.rst:596 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr ":class:`enum.IntFlag` 為 VERIFY_* 常數的其中一個集合。" -#: ../../library/ssl.rst:601 +#: ../../library/ssl.rst:602 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " @@ -912,7 +912,7 @@ msgstr "" "選擇用戶端及伺服器均可以支援最高協定版本。儘管名稱只有 「TLS」,但實際上" "「SSL」和「TLS」均可以選擇。" -#: ../../library/ssl.rst:608 +#: ../../library/ssl.rst:609 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" @@ -921,7 +921,7 @@ msgstr "" "TLS 的用戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" -#: ../../library/ssl.rst:614 +#: ../../library/ssl.rst:615 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -931,35 +931,35 @@ msgstr "" "自動協商用戶端和伺服器服務器都支援的最高協定版本,並配置用戶端語境連線。該協" "定預設啟用 :data:`CERT_REQUIRED` 和 :attr:`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:623 +#: ../../library/ssl.rst:624 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "自動協商用戶端和伺服器都支援的最高協定版本,並配置用戶端語境連線。" -#: ../../library/ssl.rst:630 +#: ../../library/ssl.rst:631 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr ":data:`PROTOCOL_TLS` 的別名。" -#: ../../library/ssl.rst:634 +#: ../../library/ssl.rst:635 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "請改用 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:638 +#: ../../library/ssl.rst:639 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "選擇第三版的 SSL 做為通道加密協定。" -#: ../../library/ssl.rst:640 +#: ../../library/ssl.rst:641 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "如果 OpenSSL 是用 ``no-ssl3`` 編譯的,則此項協定無法使用。" -#: ../../library/ssl.rst:645 +#: ../../library/ssl.rst:646 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" -#: ../../library/ssl.rst:649 +#: ../../library/ssl.rst:650 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -970,16 +970,16 @@ msgstr "" "`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" "`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" -#: ../../library/ssl.rst:657 +#: ../../library/ssl.rst:658 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "選擇 1.0 版的 TLS 做為通道加密協定。" -#: ../../library/ssl.rst:661 ../../library/ssl.rst:672 -#: ../../library/ssl.rst:683 +#: ../../library/ssl.rst:662 ../../library/ssl.rst:673 +#: ../../library/ssl.rst:684 msgid "OpenSSL has deprecated all version specific protocols." msgstr "OpenSSL 已經將所有版本特定的協定棄用。" -#: ../../library/ssl.rst:665 +#: ../../library/ssl.rst:666 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -987,7 +987,7 @@ msgstr "" "選擇 1.1 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:676 +#: ../../library/ssl.rst:677 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -995,7 +995,7 @@ msgstr "" "選擇 1.2 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:687 +#: ../../library/ssl.rst:688 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " @@ -1004,7 +1004,7 @@ msgstr "" "啟用對 SSL 實作時所產生的各種錯誤的緩解措施。此選項預設被設定。它不一定設定" "與 OpenSSL 的 ``SSL_OP_ALL`` 常數相同的旗標。" -#: ../../library/ssl.rst:695 +#: ../../library/ssl.rst:696 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " @@ -1013,11 +1013,11 @@ msgstr "" "防止 SSLv2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級 " "(peer)選用 SSLv2 做為協定版本。" -#: ../../library/ssl.rst:703 +#: ../../library/ssl.rst:704 msgid "SSLv2 is deprecated" msgstr "SSLv2 已被棄用" -#: ../../library/ssl.rst:707 +#: ../../library/ssl.rst:708 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " @@ -1026,11 +1026,11 @@ msgstr "" "防止 SSLv3 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 SSLv3 做為協定版本。" -#: ../../library/ssl.rst:715 +#: ../../library/ssl.rst:716 msgid "SSLv3 is deprecated" msgstr "SSLv3 已被棄用" -#: ../../library/ssl.rst:719 +#: ../../library/ssl.rst:720 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " @@ -1039,7 +1039,7 @@ msgstr "" "防止 TLSv1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 TLSv1 做為協定版本。" -#: ../../library/ssl.rst:725 +#: ../../library/ssl.rst:726 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." @@ -1047,7 +1047,7 @@ msgstr "" "該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." "minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" -#: ../../library/ssl.rst:732 +#: ../../library/ssl.rst:733 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " @@ -1056,11 +1056,11 @@ msgstr "" "防止 TLSv1.1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.1 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:738 ../../library/ssl.rst:749 +#: ../../library/ssl.rst:739 ../../library/ssl.rst:750 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "此選項自 OpenSSL 1.1.0 版已被棄用。" -#: ../../library/ssl.rst:743 +#: ../../library/ssl.rst:744 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " @@ -1069,7 +1069,7 @@ msgstr "" "防止 TLSv1.2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.2 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:754 +#: ../../library/ssl.rst:755 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -1081,7 +1081,7 @@ msgstr "" "級選用 TLSv1.3 做為協定版本。TSL1.3 只適用於 1.1.1 版以後的 OpenSSL。當使用 " "Python 編譯舊版的 OpenSSL 時,該標志預設為 *0*。" -#: ../../library/ssl.rst:762 +#: ../../library/ssl.rst:763 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." @@ -1089,7 +1089,7 @@ msgstr "" "此選項自 OpenSSL 1.1.0 以後已被棄用。它被添加到 2.7.15 和 3.6.3 中,以向後相" "容 OpenSSL 1.0.2。" -#: ../../library/ssl.rst:768 +#: ../../library/ssl.rst:769 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." @@ -1097,11 +1097,11 @@ msgstr "" "停用所有在 TLSv1.2 及更早版本的重協商 (renegotiation)。不發送 HelloRequest 訊" "息,並忽略通過 ClientHello 的重協商請求。" -#: ../../library/ssl.rst:771 +#: ../../library/ssl.rst:772 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "此選項僅適用於 OpenSSL 1.1.0h 及更新版本。" -#: ../../library/ssl.rst:777 +#: ../../library/ssl.rst:778 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." @@ -1109,7 +1109,7 @@ msgstr "" "使用伺服器的加密方法名稱字串排序優先順序,而不是用戶端的。此選項並不會影響到" "用戶端及 SSLv2 伺服器的 sockets。" -#: ../../library/ssl.rst:784 +#: ../../library/ssl.rst:785 msgid "" "Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " @@ -1118,7 +1118,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 DH 密鑰。這會加強向前保密但需要更多的運算" "資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:792 +#: ../../library/ssl.rst:793 msgid "" "Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " @@ -1127,7 +1127,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 ECDH 密鑰。這會加強向前保密但需要更多的運" "算資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:800 +#: ../../library/ssl.rst:801 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." @@ -1135,34 +1135,34 @@ msgstr "" "在 TLS 1.3 握手中發送虛擬的變更加密方法規範 (CCS) 消息,以使 TLS 1.3 連接看起" "來更像 TLS 1.2 連線。" -#: ../../library/ssl.rst:803 +#: ../../library/ssl.rst:804 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "此選項僅適用於 OpenSSL 1.1.1 及更新版本。" -#: ../../library/ssl.rst:809 +#: ../../library/ssl.rst:810 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" "在 SSL 通道上禁用壓縮。如果應用程序協定支援自己的壓縮方案,這會很有用。" -#: ../../library/ssl.rst:816 +#: ../../library/ssl.rst:817 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr ":class:`enum.IntFlag` 為 OP_* 常數中的一個集合。" -#: ../../library/ssl.rst:820 +#: ../../library/ssl.rst:821 msgid "Prevent client side from requesting a session ticket." msgstr "防止用戶端請求會談票據。" -#: ../../library/ssl.rst:826 +#: ../../library/ssl.rst:827 msgid "Ignore unexpected shutdown of TLS connections." msgstr "忽略意外關閉的 TLS 連線。" -#: ../../library/ssl.rst:828 ../../library/ssl.rst:844 +#: ../../library/ssl.rst:829 ../../library/ssl.rst:845 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "此選項僅適用於 OpenSSL 3.0.0 及更新版本。" -#: ../../library/ssl.rst:834 +#: ../../library/ssl.rst:835 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " @@ -1173,7 +1173,7 @@ msgstr "" "的加密套件及擴充套件也必須被該功能支援 (該功能所支援的列表可能會因平台及核心" "而有所差異)。" -#: ../../library/ssl.rst:839 +#: ../../library/ssl.rst:840 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " @@ -1184,13 +1184,13 @@ msgstr "" "的 OpenSSL 所提供的程序,而這可能並非你所想使用的,例如:當應用程式要求所有的" "加密操作由 FIPS 提供執行。" -#: ../../library/ssl.rst:850 +#: ../../library/ssl.rst:851 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "只允許 OpenSSL 與未修補的伺服器進行遺留 (legacy) 不安全重協商。" -#: ../../library/ssl.rst:857 +#: ../../library/ssl.rst:858 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." @@ -1198,7 +1198,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" "rfc:`7301` 中。" -#: ../../library/ssl.rst:864 +#: ../../library/ssl.rst:865 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." @@ -1206,7 +1206,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." "hostname_checks_common_name` 是否可寫。" -#: ../../library/ssl.rst:872 +#: ../../library/ssl.rst:873 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " @@ -1215,7 +1215,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援基於橢圓曲線的 (Elliptic Curve-based) Diffie-" "Hellman 金鑰交換。此回傳值應該要為 true 除非發布者明確禁用此功能。" -#: ../../library/ssl.rst:880 +#: ../../library/ssl.rst:881 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." @@ -1223,7 +1223,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *伺服器名稱提示* 擴充套件 (在 :rfc:`6066` 中定" "義)。" -#: ../../library/ssl.rst:887 +#: ../../library/ssl.rst:888 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -1236,45 +1236,45 @@ msgstr "" "描述。當此值為 true 時,你可以使用 :meth:`SSLContext.set_npn_protocols` 方法" "來公告你想支援的協定。" -#: ../../library/ssl.rst:897 +#: ../../library/ssl.rst:898 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 2.0 協定。" -#: ../../library/ssl.rst:903 +#: ../../library/ssl.rst:904 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 3.0 協定。" -#: ../../library/ssl.rst:909 +#: ../../library/ssl.rst:910 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" -#: ../../library/ssl.rst:915 +#: ../../library/ssl.rst:916 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.1 協定。" -#: ../../library/ssl.rst:921 +#: ../../library/ssl.rst:922 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.2 協定。" -#: ../../library/ssl.rst:927 +#: ../../library/ssl.rst:928 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" -#: ../../library/ssl.rst:933 +#: ../../library/ssl.rst:934 msgid "Whether the OpenSSL library has built-in support for TLS-PSK." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" -#: ../../library/ssl.rst:939 +#: ../../library/ssl.rst:940 msgid "Whether the OpenSSL library has built-in support for TLS-PHA." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PHA。" -#: ../../library/ssl.rst:945 +#: ../../library/ssl.rst:946 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." @@ -1282,11 +1282,11 @@ msgstr "" "支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." "get_channel_binding` 的參數。" -#: ../../library/ssl.rst:952 +#: ../../library/ssl.rst:953 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::" -#: ../../library/ssl.rst:954 +#: ../../library/ssl.rst:955 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" @@ -1294,13 +1294,13 @@ msgstr "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" -#: ../../library/ssl.rst:961 +#: ../../library/ssl.rst:962 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組: ::" -#: ../../library/ssl.rst:964 +#: ../../library/ssl.rst:965 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" @@ -1308,11 +1308,11 @@ msgstr "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" -#: ../../library/ssl.rst:971 +#: ../../library/ssl.rst:972 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::" -#: ../../library/ssl.rst:973 +#: ../../library/ssl.rst:974 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" @@ -1324,7 +1324,7 @@ msgstr "" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" -#: ../../library/ssl.rst:984 +#: ../../library/ssl.rst:985 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`_ 包" "含了此列表以及其含義定義所在的 RFC 的引用。" -#: ../../library/ssl.rst:988 +#: ../../library/ssl.rst:989 msgid "" "Used as the return value of the callback function in :meth:`SSLContext." "set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" -#: ../../library/ssl.rst:995 +#: ../../library/ssl.rst:996 msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants." msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合。" -#: ../../library/ssl.rst:1001 +#: ../../library/ssl.rst:1002 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1356,7 +1356,7 @@ msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" -#: ../../library/ssl.rst:1010 +#: ../../library/ssl.rst:1011 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1367,11 +1367,11 @@ msgstr "" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " "socket)。" -#: ../../library/ssl.rst:1019 +#: ../../library/ssl.rst:1020 msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" -#: ../../library/ssl.rst:1025 +#: ../../library/ssl.rst:1026 msgid "" ":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" "`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." @@ -1379,7 +1379,7 @@ msgstr "" "用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." "minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" -#: ../../library/ssl.rst:1033 +#: ../../library/ssl.rst:1034 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" @@ -1388,11 +1388,11 @@ msgstr "" "最低或最高支援的 SSL 或 TLS 版本。這些是特殊常數。它們的值並不反映可用的最低" "和最高 TLS/SSL 版本。" -#: ../../library/ssl.rst:1043 +#: ../../library/ssl.rst:1044 msgid "SSL 3.0 to TLS 1.3." msgstr "SSL 3.0 到 TLS 1.3。" -#: ../../library/ssl.rst:1047 +#: ../../library/ssl.rst:1048 msgid "" "All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" "`TLSVersion.TLSv1_3` are deprecated." @@ -1400,47 +1400,47 @@ msgstr "" "除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" "class:`TLSVersion` 成員都已被棄用。" -#: ../../library/ssl.rst:1052 +#: ../../library/ssl.rst:1053 msgid "SSL Sockets" msgstr "SSL Sockets" -#: ../../library/ssl.rst:1056 +#: ../../library/ssl.rst:1057 msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL sockets 提供以下 :ref:`socket-objects` 方法:" -#: ../../library/ssl.rst:1058 +#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.accept`" msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1059 +#: ../../library/ssl.rst:1060 msgid ":meth:`~socket.socket.bind`" msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1060 +#: ../../library/ssl.rst:1061 msgid ":meth:`~socket.socket.close`" msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1061 +#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.connect`" msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1062 +#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.detach`" msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1063 +#: ../../library/ssl.rst:1064 msgid ":meth:`~socket.socket.fileno`" msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1064 +#: ../../library/ssl.rst:1065 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" msgstr ":meth:`~socket.socket.getpeername`、:meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1065 +#: ../../library/ssl.rst:1066 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1066 +#: ../../library/ssl.rst:1067 msgid "" ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" "`~socket.socket.setblocking`" @@ -1448,15 +1448,15 @@ msgstr "" ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" "`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1068 +#: ../../library/ssl.rst:1069 msgid ":meth:`~socket.socket.listen`" msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1069 +#: ../../library/ssl.rst:1070 msgid ":meth:`~socket.socket.makefile`" msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1070 +#: ../../library/ssl.rst:1071 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" @@ -1464,7 +1464,7 @@ msgstr "" ":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (但不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1072 +#: ../../library/ssl.rst:1073 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" @@ -1472,7 +1472,7 @@ msgstr "" ":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同樣不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1074 +#: ../../library/ssl.rst:1075 msgid "" ":meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used for " "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" @@ -1480,11 +1480,11 @@ msgstr "" ":meth:`~socket.socket.sendfile` (但 :mod:`os.sendfile` 只能用於純文本 " "sockets,其餘則會使用 :meth:`~socket.socket.send`)" -#: ../../library/ssl.rst:1076 +#: ../../library/ssl.rst:1077 msgid ":meth:`~socket.socket.shutdown`" msgstr ":meth:`~socket.socket.shutdown`" -#: ../../library/ssl.rst:1078 +#: ../../library/ssl.rst:1079 msgid "" "However, since the SSL (and TLS) protocol has its own framing atop of TCP, " "the SSL sockets abstraction can, in certain respects, diverge from the " @@ -1495,18 +1495,18 @@ msgstr "" "sockets 的抽象可能會與普通作業系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" -#: ../../library/ssl.rst:1083 +#: ../../library/ssl.rst:1084 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" -#: ../../library/ssl.rst:1086 +#: ../../library/ssl.rst:1087 msgid "The :meth:`sendfile` method was added." msgstr "新增 :meth:`sendfile` 方法。" -#: ../../library/ssl.rst:1089 +#: ../../library/ssl.rst:1090 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " @@ -1515,7 +1515,7 @@ msgstr "" ":meth:`shutdown` 不會在每次接收或發送位元組時重置 socket 超時時間。現在," "socket 超時時間是關閉操作的最大總持續時間。" -#: ../../library/ssl.rst:1094 +#: ../../library/ssl.rst:1095 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." @@ -1523,7 +1523,7 @@ msgstr "" "直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." "wrap_socket` 來包裝 socket。" -#: ../../library/ssl.rst:1098 +#: ../../library/ssl.rst:1099 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " @@ -1532,7 +1532,7 @@ msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" -#: ../../library/ssl.rst:1104 +#: ../../library/ssl.rst:1105 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" @@ -1541,11 +1541,11 @@ msgstr "" "Python 現在內部使用了 ``SSL_read_ex`` 和 ``SSL_write_ex`` 函式。這些函式支援" "讀取和寫入大於 2 GB 的資料。寫入零長度的資料不再會導致協定違規錯誤。" -#: ../../library/ssl.rst:1109 +#: ../../library/ssl.rst:1110 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "SSL sockets 還具有以下附加方法和屬性:" -#: ../../library/ssl.rst:1113 +#: ../../library/ssl.rst:1114 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " @@ -1554,7 +1554,7 @@ msgstr "" "從 SSL socket 讀取 *len* 位元組的資料,並將結果以 ``bytes`` 實例的形式回傳。" "如果指定了 *buffer*,則將資料讀入緩衝區,並回傳讀取的位元組。" -#: ../../library/ssl.rst:1117 +#: ../../library/ssl.rst:1118 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." @@ -1562,14 +1562,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" -#: ../../library/ssl.rst:1120 +#: ../../library/ssl.rst:1121 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`read` 也可能觸發寫入操作。" -#: ../../library/ssl.rst:1123 +#: ../../library/ssl.rst:1124 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " @@ -1578,19 +1578,19 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是讀" "取最多 *len* 位元組的總最大持續時間。" -#: ../../library/ssl.rst:1128 +#: ../../library/ssl.rst:1129 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "請改用 :meth:`~SSLSocket.recv` 來替換掉 :meth:`~SSLSocket.read`。" -#: ../../library/ssl.rst:1133 +#: ../../library/ssl.rst:1134 msgid "" -"Write *buf* to the SSL socket and return the number of bytes written. The " -"*buf* argument must be an object supporting the buffer interface." +"Write *data* to the SSL socket and return the number of bytes written. The " +"*data* argument must be an object supporting the buffer interface." msgstr "" -"將 *buf* 寫入 SSL socket 並回傳寫入的位元組數量。*buf* 引數必須是支援緩衝區介" +"將 *data* 寫入 SSL socket 並回傳寫入的位元組數量。*data* 引數必須是支援緩衝區介" "面的物件。" -#: ../../library/ssl.rst:1136 +#: ../../library/ssl.rst:1137 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." @@ -1598,26 +1598,26 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" -#: ../../library/ssl.rst:1139 +#: ../../library/ssl.rst:1140 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`write` 也可能觸發讀取操作。" -#: ../../library/ssl.rst:1142 +#: ../../library/ssl.rst:1143 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " -"The socket timeout is now the maximum total duration to write *buf*." +"The socket timeout is now the maximum total duration to write *data*." msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是寫" -"入 *buf* 的總最大持續時間。" +"入 *data* 的總最大持續時間。" -#: ../../library/ssl.rst:1146 +#: ../../library/ssl.rst:1147 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "請改用 :meth:`~SSLSocket.send` 來替換掉 :meth:`~SSLSocket.write`。" -#: ../../library/ssl.rst:1151 +#: ../../library/ssl.rst:1152 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1629,7 +1629,7 @@ msgstr "" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" "一個已建立的 SSL 連接,即握手已完成,且未呼叫 :meth:`SSLSocket.unwrap`。" -#: ../../library/ssl.rst:1157 +#: ../../library/ssl.rst:1158 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." @@ -1637,20 +1637,27 @@ msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" -#: ../../library/ssl.rst:1163 +#: ../../library/ssl.rst:1164 msgid "Perform the SSL setup handshake." msgstr "執行 SSL 設定握手。" -#: ../../library/ssl.rst:1165 +#: ../../library/ssl.rst:1166 +msgid "" +"If *block* is true and the timeout obtained by :meth:`~socket.socket." +"gettimeout` is zero, the socket is set in blocking mode until the handshake " +"is performed." +msgstr "" + +#: ../../library/ssl.rst:1169 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" +"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`。" +"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`!match_hostname`。" -#: ../../library/ssl.rst:1170 +#: ../../library/ssl.rst:1174 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." @@ -1658,18 +1665,18 @@ msgstr "" "Socket 超時時間已經不會在每次接收或傳送位元組時重置。現在,超時時間是握手過程" "的最大總持續時間。" -#: ../../library/ssl.rst:1174 +#: ../../library/ssl.rst:1178 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 " +"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 地址,握手將會提前" +"`!match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" "中止,並向對方發送 TLS 警報訊息。" -#: ../../library/ssl.rst:1182 +#: ../../library/ssl.rst:1186 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:" @@ -1678,7 +1685,7 @@ msgstr "" "如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" "`ValueError`。" -#: ../../library/ssl.rst:1186 +#: ../../library/ssl.rst:1190 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1695,7 +1702,7 @@ msgstr "" "``issuer`` (簽發證書的主體)。如果證書中包含 *Subject Alternative Name* 擴充 " "(參考\\ :rfc:`3280`\\ ),字典中還會有一個 ``subjectAltName`` 鍵。" -#: ../../library/ssl.rst:1195 +#: ../../library/ssl.rst:1199 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1706,7 +1713,7 @@ msgstr "" "names, RDNs) 序列的元組,這些 RDN 來自證書資料結構中的相應欄位。每個 RDN 都是" "一組名稱與值的對。以下是現實中的範例: ::" -#: ../../library/ssl.rst:1200 +#: ../../library/ssl.rst:1204 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1748,7 +1755,7 @@ msgstr "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:1219 +#: ../../library/ssl.rst:1223 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1760,13 +1767,13 @@ msgstr "" "以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" "const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" -#: ../../library/ssl.rst:1225 +#: ../../library/ssl.rst:1229 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "對於用戶端 SSL socket,伺服器將永遠提供證書,無論是否需要進行驗證;" -#: ../../library/ssl.rst:1228 +#: ../../library/ssl.rst:1232 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1777,41 +1784,41 @@ msgstr "" "是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" "`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" -#: ../../library/ssl.rst:1233 +#: ../../library/ssl.rst:1237 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "請見 :attr:`SSLContext.check_hostname`。" -#: ../../library/ssl.rst:1235 +#: ../../library/ssl.rst:1239 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1239 +#: ../../library/ssl.rst:1243 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1244 +#: ../../library/ssl.rst:1248 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1249 +#: ../../library/ssl.rst:1253 msgid "" "Returns verified certificate chain provided by the other end of the SSL " "channel as a list of DER-encoded bytes. If certificate verification was " "disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." msgstr "" -#: ../../library/ssl.rst:1258 +#: ../../library/ssl.rst:1262 msgid "" "Returns raw certificate chain provided by the other end of the SSL channel " "as a list of DER-encoded bytes." msgstr "" -#: ../../library/ssl.rst:1265 +#: ../../library/ssl.rst:1269 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1819,7 +1826,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1271 +#: ../../library/ssl.rst:1275 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1829,25 +1836,25 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1282 +#: ../../library/ssl.rst:1286 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1285 +#: ../../library/ssl.rst:1289 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1292 +#: ../../library/ssl.rst:1296 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1295 +#: ../../library/ssl.rst:1299 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` " @@ -1856,7 +1863,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1305 +#: ../../library/ssl.rst:1309 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 " @@ -1864,7 +1871,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: ../../library/ssl.rst:1315 +#: ../../library/ssl.rst:1319 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1872,11 +1879,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1324 ../../library/ssl.rst:1693 +#: ../../library/ssl.rst:1328 ../../library/ssl.rst:1697 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1328 +#: ../../library/ssl.rst:1332 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1885,7 +1892,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1336 +#: ../../library/ssl.rst:1340 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 " @@ -1893,26 +1900,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1341 +#: ../../library/ssl.rst:1345 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1345 +#: ../../library/ssl.rst:1349 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1349 +#: ../../library/ssl.rst:1353 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1356 +#: ../../library/ssl.rst:1360 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1921,29 +1928,29 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1366 +#: ../../library/ssl.rst:1370 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1375 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: ../../library/ssl.rst:1377 +#: ../../library/ssl.rst:1381 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1384 +#: ../../library/ssl.rst:1388 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1389 +#: ../../library/ssl.rst:1393 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1951,7 +1958,7 @@ msgid "" "org\"``)." msgstr "" -#: ../../library/ssl.rst:1397 +#: ../../library/ssl.rst:1401 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1959,11 +1966,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1410 +#: ../../library/ssl.rst:1414 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1414 +#: ../../library/ssl.rst:1418 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1971,7 +1978,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1421 +#: ../../library/ssl.rst:1425 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1982,109 +1989,109 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1434 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "*client* / **server**" msgstr "*client* / **server**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1438 +#: ../../library/ssl.rst:1442 msgid "*SSLv2*" msgstr "*SSLv2*" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 -#: ../../library/ssl.rst:1440 ../../library/ssl.rst:1441 #: ../../library/ssl.rst:1442 ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1444 ../../library/ssl.rst:1445 +#: ../../library/ssl.rst:1446 ../../library/ssl.rst:1447 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 -#: ../../library/ssl.rst:1441 ../../library/ssl.rst:1442 -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1442 ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1445 ../../library/ssl.rst:1446 +#: ../../library/ssl.rst:1447 msgid "no" msgstr "" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1442 ../../library/ssl.rst:1444 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1439 +#: ../../library/ssl.rst:1443 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1439 ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1443 ../../library/ssl.rst:1444 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1444 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1441 +#: ../../library/ssl.rst:1445 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1442 +#: ../../library/ssl.rst:1446 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1447 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1446 +#: ../../library/ssl.rst:1450 msgid "Footnotes" msgstr "註腳" -#: ../../library/ssl.rst:1447 +#: ../../library/ssl.rst:1451 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv2 的 :data:`OP_NO_SSLv2`。" -#: ../../library/ssl.rst:1448 +#: ../../library/ssl.rst:1452 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv3 的 :data:`OP_NO_SSLv3`。" -#: ../../library/ssl.rst:1449 +#: ../../library/ssl.rst:1453 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1454 +#: ../../library/ssl.rst:1458 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1459 +#: ../../library/ssl.rst:1463 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -2094,14 +2101,14 @@ msgid "" "ciphers and no ``MD5`` ciphers." msgstr "" -#: ../../library/ssl.rst:1469 +#: ../../library/ssl.rst:1473 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." msgstr "" -#: ../../library/ssl.rst:1475 +#: ../../library/ssl.rst:1479 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 " @@ -2110,7 +2117,7 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1483 +#: ../../library/ssl.rst:1487 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " @@ -2118,29 +2125,29 @@ msgid "" "may result in surprising behavior." msgstr "" -#: ../../library/ssl.rst:1490 +#: ../../library/ssl.rst:1494 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" -#: ../../library/ssl.rst:1495 +#: ../../library/ssl.rst:1499 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr ":class:`SSLContext` 物件具有以下方法和屬性:" -#: ../../library/ssl.rst:1499 +#: ../../library/ssl.rst:1503 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1503 +#: ../../library/ssl.rst:1507 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1505 +#: ../../library/ssl.rst:1509 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" @@ -2148,7 +2155,7 @@ msgstr "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" -#: ../../library/ssl.rst:1513 +#: ../../library/ssl.rst:1517 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -2159,7 +2166,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1522 +#: ../../library/ssl.rst:1526 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2171,24 +2178,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1531 +#: ../../library/ssl.rst:1535 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1535 +#: ../../library/ssl.rst:1539 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1538 +#: ../../library/ssl.rst:1542 msgid "New optional argument *password*." msgstr "新增可選引數 *password*。" -#: ../../library/ssl.rst:1543 +#: ../../library/ssl.rst:1547 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -2197,7 +2204,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1549 +#: ../../library/ssl.rst:1553 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2206,35 +2213,35 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1559 +#: ../../library/ssl.rst:1563 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." msgstr "" -#: ../../library/ssl.rst:1563 +#: ../../library/ssl.rst:1567 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1567 +#: ../../library/ssl.rst:1571 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1572 +#: ../../library/ssl.rst:1576 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " "`_." msgstr "" -#: ../../library/ssl.rst:1577 +#: ../../library/ssl.rst:1581 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -2242,11 +2249,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1582 +#: ../../library/ssl.rst:1586 msgid "New optional argument *cadata*" msgstr "新增可選引數 *cadata*" -#: ../../library/ssl.rst:1587 +#: ../../library/ssl.rst:1591 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -2256,19 +2263,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1595 +#: ../../library/ssl.rst:1599 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1602 +#: ../../library/ssl.rst:1606 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1607 +#: ../../library/ssl.rst:1611 msgid "" ">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" ">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" @@ -2326,7 +2333,7 @@ msgstr "" " 'strength_bits': 128,\n" " 'symmetric': 'aes-128-gcm'}]" -#: ../../library/ssl.rst:1639 +#: ../../library/ssl.rst:1643 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2336,7 +2343,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1648 +#: ../../library/ssl.rst:1652 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_" msgstr "" -#: ../../library/ssl.rst:1787 +#: ../../library/ssl.rst:1791 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1793 +#: ../../library/ssl.rst:1797 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2526,13 +2535,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1799 +#: ../../library/ssl.rst:1803 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1802 +#: ../../library/ssl.rst:1806 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2543,7 +2552,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1810 +#: ../../library/ssl.rst:1814 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2552,7 +2561,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1816 +#: ../../library/ssl.rst:1820 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2562,7 +2571,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1823 +#: ../../library/ssl.rst:1827 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2572,40 +2581,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1830 +#: ../../library/ssl.rst:1834 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1832 +#: ../../library/ssl.rst:1836 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1835 +#: ../../library/ssl.rst:1839 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1839 ../../library/ssl.rst:1866 +#: ../../library/ssl.rst:1843 ../../library/ssl.rst:1870 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1842 +#: ../../library/ssl.rst:1846 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1848 +#: ../../library/ssl.rst:1852 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be assigned to on instances of :class:" "`SSLContext` in order to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1858 +#: ../../library/ssl.rst:1862 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2613,26 +2622,26 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1863 +#: ../../library/ssl.rst:1867 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1869 +#: ../../library/ssl.rst:1873 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1875 +#: ../../library/ssl.rst:1879 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`." msgstr "" -#: ../../library/ssl.rst:1883 +#: ../../library/ssl.rst:1887 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2641,7 +2650,7 @@ msgid "" "the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1888 +#: ../../library/ssl.rst:1892 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2651,7 +2660,7 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1894 +#: ../../library/ssl.rst:1898 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:" @@ -2664,7 +2673,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1907 +#: ../../library/ssl.rst:1911 msgid "" "import socket, ssl\n" "\n" @@ -2688,7 +2697,7 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1922 +#: ../../library/ssl.rst:1926 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2696,7 +2705,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1929 +#: ../../library/ssl.rst:1933 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2705,7 +2714,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1939 +#: ../../library/ssl.rst:1943 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2713,7 +2722,7 @@ msgid "" "const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1944 +#: ../../library/ssl.rst:1948 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2723,38 +2732,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1957 +#: ../../library/ssl.rst:1961 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1964 +#: ../../library/ssl.rst:1968 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." msgstr "" -#: ../../library/ssl.rst:1972 +#: ../../library/ssl.rst:1976 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." msgstr "" -#: ../../library/ssl.rst:1976 +#: ../../library/ssl.rst:1980 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr ":attr:`SSLContext.options` 會回傳 :class:`Options` 旗標:" -#: ../../library/ssl.rst:1984 +#: ../../library/ssl.rst:1988 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." msgstr "" -#: ../../library/ssl.rst:1990 +#: ../../library/ssl.rst:1994 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2762,13 +2771,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1995 +#: ../../library/ssl.rst:1999 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1998 +#: ../../library/ssl.rst:2002 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 " @@ -2776,66 +2785,66 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:2008 +#: ../../library/ssl.rst:2012 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:2013 +#: ../../library/ssl.rst:2017 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:2021 +#: ../../library/ssl.rst:2025 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:2026 +#: ../../library/ssl.rst:2030 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" -#: ../../library/ssl.rst:2034 +#: ../../library/ssl.rst:2038 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)." msgstr "" -#: ../../library/ssl.rst:2040 +#: ../../library/ssl.rst:2044 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr ":attr:`SSLContext.verify_flags` 會回傳 :class:`VerifyFlags` 旗標:" -#: ../../library/ssl.rst:2048 +#: ../../library/ssl.rst:2052 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`." msgstr "" -#: ../../library/ssl.rst:2052 +#: ../../library/ssl.rst:2056 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr ":attr:`SSLContext.verify_mode` 會回傳 :class:`VerifyMode` 列舉:" -#: ../../library/ssl.rst:2060 +#: ../../library/ssl.rst:2064 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a client-side connection." msgstr "" -#: ../../library/ssl.rst:2062 ../../library/ssl.rst:2111 +#: ../../library/ssl.rst:2066 ../../library/ssl.rst:2115 msgid "" "In general, certificate based authentication should be preferred over this " "method." msgstr "" -#: ../../library/ssl.rst:2064 +#: ../../library/ssl.rst:2068 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " @@ -2847,27 +2856,27 @@ msgid "" "shared key. Return a zero length PSK to reject the connection." msgstr "" -#: ../../library/ssl.rst:2074 ../../library/ssl.rst:2120 +#: ../../library/ssl.rst:2078 ../../library/ssl.rst:2124 msgid "Setting ``callback`` to :const:`None` removes any existing callback." msgstr "" -#: ../../library/ssl.rst:2077 +#: ../../library/ssl.rst:2081 msgid "When using TLS 1.3:" msgstr "使用 TLS 1.3 時:" -#: ../../library/ssl.rst:2079 +#: ../../library/ssl.rst:2083 msgid "the ``hint`` parameter is always :const:`None`." msgstr "``hint`` 參數始終為 :const:`None`。" -#: ../../library/ssl.rst:2080 +#: ../../library/ssl.rst:2084 msgid "client-identity must be a non-empty string." msgstr "" -#: ../../library/ssl.rst:2082 ../../library/ssl.rst:2129 +#: ../../library/ssl.rst:2086 ../../library/ssl.rst:2133 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../library/ssl.rst:2084 +#: ../../library/ssl.rst:2088 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" "context.check_hostname = False\n" @@ -2888,18 +2897,18 @@ msgid "" "context.set_psk_client_callback(callback)" msgstr "" -#: ../../library/ssl.rst:2102 ../../library/ssl.rst:2147 +#: ../../library/ssl.rst:2106 ../../library/ssl.rst:2151 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " "``False``." msgstr "" -#: ../../library/ssl.rst:2109 +#: ../../library/ssl.rst:2113 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a server-side connection." msgstr "" -#: ../../library/ssl.rst:2113 +#: ../../library/ssl.rst:2117 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " @@ -2909,19 +2918,19 @@ msgid "" "connection." msgstr "" -#: ../../library/ssl.rst:2122 +#: ../../library/ssl.rst:2126 msgid "" "The parameter ``identity_hint`` is an optional identity hint string sent to " "the client. The string must be less than or equal to ``256`` octets when " "UTF-8 encoded." msgstr "" -#: ../../library/ssl.rst:2127 +#: ../../library/ssl.rst:2131 msgid "" "When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." msgstr "" -#: ../../library/ssl.rst:2131 +#: ../../library/ssl.rst:2135 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.maximum_version = ssl.TLSVersion.TLSv1_2\n" @@ -2940,11 +2949,11 @@ msgid "" "context.set_psk_server_callback(callback, 'ServerId_1')" msgstr "" -#: ../../library/ssl.rst:2159 +#: ../../library/ssl.rst:2163 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2161 +#: ../../library/ssl.rst:2165 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2955,7 +2964,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2169 +#: ../../library/ssl.rst:2173 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2969,7 +2978,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2179 +#: ../../library/ssl.rst:2183 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2982,14 +2991,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2189 +#: ../../library/ssl.rst:2193 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2193 +#: ../../library/ssl.rst:2197 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -2999,11 +3008,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2198 +#: ../../library/ssl.rst:2202 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2200 +#: ../../library/ssl.rst:2204 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -3019,7 +3028,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2213 +#: ../../library/ssl.rst:2217 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3041,11 +3050,11 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2224 +#: ../../library/ssl.rst:2228 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2226 +#: ../../library/ssl.rst:2230 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -3057,11 +3066,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2235 +#: ../../library/ssl.rst:2239 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2237 +#: ../../library/ssl.rst:2241 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -3069,7 +3078,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2243 +#: ../../library/ssl.rst:2247 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -3085,11 +3094,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2251 +#: ../../library/ssl.rst:2255 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2253 +#: ../../library/ssl.rst:2257 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -3099,7 +3108,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2260 +#: ../../library/ssl.rst:2264 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -3125,28 +3134,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2286 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2288 +#: ../../library/ssl.rst:2292 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2291 +#: ../../library/ssl.rst:2295 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2293 +#: ../../library/ssl.rst:2297 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2296 +#: ../../library/ssl.rst:2300 msgid "" "try:\n" " import ssl\n" @@ -3156,27 +3165,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2304 +#: ../../library/ssl.rst:2308 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2306 +#: ../../library/ssl.rst:2310 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2309 +#: ../../library/ssl.rst:2313 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2311 +#: ../../library/ssl.rst:2315 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2315 +#: ../../library/ssl.rst:2319 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3184,14 +3193,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2318 +#: ../../library/ssl.rst:2322 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2322 +#: ../../library/ssl.rst:2326 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3199,7 +3208,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2327 +#: ../../library/ssl.rst:2331 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -3208,7 +3217,7 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2333 +#: ../../library/ssl.rst:2337 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3218,21 +3227,21 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2337 +#: ../../library/ssl.rst:2341 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2339 +#: ../../library/ssl.rst:2343 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2341 +#: ../../library/ssl.rst:2345 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2344 +#: ../../library/ssl.rst:2348 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" @@ -3322,13 +3331,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2384 +#: ../../library/ssl.rst:2388 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2387 +#: ../../library/ssl.rst:2391 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3370,11 +3379,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2411 +#: ../../library/ssl.rst:2415 msgid "Server-side operation" msgstr "伺服器端操作" -#: ../../library/ssl.rst:2413 +#: ../../library/ssl.rst:2417 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3383,7 +3392,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2419 +#: ../../library/ssl.rst:2423 msgid "" "import socket, ssl\n" "\n" @@ -3403,14 +3412,14 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2428 +#: ../../library/ssl.rst:2432 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::" msgstr "" -#: ../../library/ssl.rst:2432 +#: ../../library/ssl.rst:2436 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3430,13 +3439,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2441 +#: ../../library/ssl.rst:2445 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2444 +#: ../../library/ssl.rst:2448 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3450,7 +3459,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2455 +#: ../../library/ssl.rst:2459 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3458,18 +3467,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2463 +#: ../../library/ssl.rst:2467 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2469 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2469 +#: ../../library/ssl.rst:2473 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -3481,13 +3490,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2481 +#: ../../library/ssl.rst:2485 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2485 +#: ../../library/ssl.rst:2489 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -3497,7 +3506,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2492 +#: ../../library/ssl.rst:2496 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3506,13 +3515,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2498 +#: ../../library/ssl.rst:2502 msgid "" "(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:2501 +#: ../../library/ssl.rst:2505 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -3520,7 +3529,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2506 +#: ../../library/ssl.rst:2510 msgid "" "while True:\n" " try:\n" @@ -3540,7 +3549,7 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2517 +#: ../../library/ssl.rst:2521 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. " "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:2620 +#: ../../library/ssl.rst:2624 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." msgstr "" -#: ../../library/ssl.rst:2626 +#: ../../library/ssl.rst:2630 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2632 +#: ../../library/ssl.rst:2636 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2637 +#: ../../library/ssl.rst:2641 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2641 +#: ../../library/ssl.rst:2645 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2646 +#: ../../library/ssl.rst:2650 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2651 +#: ../../library/ssl.rst:2655 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2654 +#: ../../library/ssl.rst:2658 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2663 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2669 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2671 +#: ../../library/ssl.rst:2675 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2683 +#: ../../library/ssl.rst:2687 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2686 +#: ../../library/ssl.rst:2690 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2688 +#: ../../library/ssl.rst:2692 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:" @@ -3832,13 +3841,13 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2695 +#: ../../library/ssl.rst:2699 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2698 +#: ../../library/ssl.rst:2702 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3852,13 +3861,13 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2704 +#: ../../library/ssl.rst:2708 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2707 +#: ../../library/ssl.rst:2711 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -3866,15 +3875,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2713 +#: ../../library/ssl.rst:2717 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2716 +#: ../../library/ssl.rst:2720 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2718 +#: ../../library/ssl.rst:2722 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -3889,13 +3898,13 @@ msgid "" "enabled." msgstr "" -#: ../../library/ssl.rst:2730 +#: ../../library/ssl.rst:2734 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"`!match_hostname`." msgstr "" -#: ../../library/ssl.rst:2734 +#: ../../library/ssl.rst:2738 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3903,11 +3912,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2740 +#: ../../library/ssl.rst:2744 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2742 +#: ../../library/ssl.rst:2746 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 " @@ -3916,7 +3925,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2750 +#: ../../library/ssl.rst:2754 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3926,7 +3935,7 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2755 +#: ../../library/ssl.rst:2759 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -3934,11 +3943,11 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2762 +#: ../../library/ssl.rst:2766 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2764 +#: ../../library/ssl.rst:2768 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -3951,11 +3960,11 @@ msgid "" "command on your system." msgstr "" -#: ../../library/ssl.rst:2775 +#: ../../library/ssl.rst:2779 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2777 +#: ../../library/ssl.rst:2781 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3966,17 +3975,17 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2789 +#: ../../library/ssl.rst:2793 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2793 +#: ../../library/ssl.rst:2797 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2796 +#: ../../library/ssl.rst:2800 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." @@ -3984,14 +3993,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2800 +#: ../../library/ssl.rst:2804 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2803 +#: ../../library/ssl.rst:2807 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3999,21 +4008,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2807 +#: ../../library/ssl.rst:2811 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2813 +#: ../../library/ssl.rst:2817 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2814 +#: ../../library/ssl.rst:2818 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2816 +#: ../../library/ssl.rst:2820 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -4021,11 +4030,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2817 +#: ../../library/ssl.rst:2821 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2819 +#: ../../library/ssl.rst:2823 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -4033,19 +4042,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2820 +#: ../../library/ssl.rst:2824 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2822 +#: ../../library/ssl.rst:2826 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2823 +#: ../../library/ssl.rst:2827 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2825 +#: ../../library/ssl.rst:2829 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -4053,11 +4062,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2826 +#: ../../library/ssl.rst:2830 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2828 +#: ../../library/ssl.rst:2832 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -4065,19 +4074,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2829 +#: ../../library/ssl.rst:2833 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2831 +#: ../../library/ssl.rst:2835 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2832 +#: ../../library/ssl.rst:2836 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2834 +#: ../../library/ssl.rst:2838 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -4085,11 +4094,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2835 +#: ../../library/ssl.rst:2839 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2837 +#: ../../library/ssl.rst:2841 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -4097,11 +4106,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2838 +#: ../../library/ssl.rst:2842 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2840 +#: ../../library/ssl.rst:2844 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -4109,7 +4118,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2841 +#: ../../library/ssl.rst:2845 msgid "Mozilla" msgstr "Mozilla" @@ -4137,10 +4146,10 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2152 +#: ../../library/ssl.rst:2156 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2154 +#: ../../library/ssl.rst:2158 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" diff --git a/library/statistics.po b/library/statistics.po index c957d1b2f2..73131e7afd 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -469,6 +469,8 @@ msgid "" ">>> round(geometric_mean([54, 24, 36]), 1)\n" "36.0" msgstr "" +">>> round(geometric_mean([54, 24, 36]), 1)\n" +"36.0" #: ../../library/statistics.rst:222 msgid "" diff --git a/library/stdtypes.po b/library/stdtypes.po index df265115a6..d46b56f45d 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-17 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:282 #: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 -#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4116 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:1007 #: ../../library/stdtypes.rst:1010 ../../library/stdtypes.rst:1239 -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:295 #: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:1250 -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:2853 -#: ../../library/stdtypes.rst:4111 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:4126 ../../library/stdtypes.rst:4128 msgid "\\(2)" msgstr "\\(2)" @@ -177,18 +177,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2855 -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:2859 -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4115 -#: ../../library/stdtypes.rst:4117 ../../library/stdtypes.rst:4119 -#: ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2876 ../../library/stdtypes.rst:4130 +#: ../../library/stdtypes.rst:4132 ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4136 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:326 #: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:1049 -#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2887 -#: ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:4166 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2672 -#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4078 ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2687 +#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4093 ../../library/stdtypes.rst:4116 msgid "Meaning" msgstr "含義" @@ -570,8 +570,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2849 -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2864 +#: ../../library/stdtypes.rst:4153 msgid "\\(6)" msgstr "\\(6)" @@ -608,9 +608,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 -#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:2877 -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4134 -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:2889 ../../library/stdtypes.rst:2892 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4156 msgid "\\(5)" msgstr "\\(5)" @@ -768,9 +768,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:427 -#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2863 -#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4123 -#: ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2878 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4142 msgid "\\(4)" msgstr "\\(4)" @@ -3085,7 +3085,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3277 +#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3292 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3121,11 +3121,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3296 +#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3311 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3299 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3314 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3421,13 +3421,37 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2160 ../../library/stdtypes.rst:2694 +msgid "For example:" +msgstr "舉例來說:" + +#: ../../library/stdtypes.rst:2162 +msgid "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" +msgstr "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" + +#: ../../library/stdtypes.rst:2171 +msgid "See also :meth:`title`." +msgstr "另請參閱 :meth:`title`。" + +#: ../../library/stdtypes.rst:2176 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:2181 +#: ../../library/stdtypes.rst:2194 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 " @@ -3435,27 +3459,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2202 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:2196 +#: ../../library/stdtypes.rst:2209 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:2199 +#: ../../library/stdtypes.rst:2212 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2206 +#: ../../library/stdtypes.rst:2219 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 " @@ -3464,7 +3488,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2224 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3476,13 +3500,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2216 +#: ../../library/stdtypes.rst:2229 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:2219 +#: ../../library/stdtypes.rst:2232 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3494,13 +3518,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2241 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2230 +#: ../../library/stdtypes.rst:2243 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, " @@ -3508,7 +3532,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2248 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3516,7 +3540,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2243 +#: ../../library/stdtypes.rst:2256 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 " @@ -3524,13 +3548,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2264 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:2255 +#: ../../library/stdtypes.rst:2268 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3542,14 +3566,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2265 +#: ../../library/stdtypes.rst:2278 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:2269 +#: ../../library/stdtypes.rst:2282 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3561,7 +3585,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2279 +#: ../../library/stdtypes.rst:2292 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 " @@ -3569,31 +3593,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2283 +#: ../../library/stdtypes.rst:2296 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2289 +#: ../../library/stdtypes.rst:2302 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:2296 +#: ../../library/stdtypes.rst:2309 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2315 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:2309 +#: ../../library/stdtypes.rst:2322 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 " @@ -3601,7 +3625,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2317 +#: ../../library/stdtypes.rst:2330 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 " @@ -3610,7 +3634,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2326 +#: ../../library/stdtypes.rst:2339 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 " @@ -3619,7 +3643,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2331 +#: ../../library/stdtypes.rst:2344 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3631,13 +3655,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2336 +#: ../../library/stdtypes.rst:2349 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:2339 +#: ../../library/stdtypes.rst:2352 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3649,7 +3673,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2346 +#: ../../library/stdtypes.rst:2359 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, " @@ -3658,7 +3682,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2352 +#: ../../library/stdtypes.rst:2365 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3668,20 +3692,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2377 -#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:2441 -#: ../../library/stdtypes.rst:2509 ../../library/stdtypes.rst:2577 -#: ../../library/stdtypes.rst:3612 ../../library/stdtypes.rst:3630 -#: ../../library/stdtypes.rst:3720 ../../library/stdtypes.rst:3736 -#: ../../library/stdtypes.rst:3761 ../../library/stdtypes.rst:3775 -#: ../../library/stdtypes.rst:3803 ../../library/stdtypes.rst:3817 -#: ../../library/stdtypes.rst:3835 ../../library/stdtypes.rst:3862 -#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3912 -#: ../../library/stdtypes.rst:3954 ../../library/stdtypes.rst:3978 +#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:2390 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:2454 +#: ../../library/stdtypes.rst:2522 ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:3627 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:3735 ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:3776 ../../library/stdtypes.rst:3790 +#: ../../library/stdtypes.rst:3818 ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3850 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:3900 ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3969 ../../library/stdtypes.rst:3993 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2361 +#: ../../library/stdtypes.rst:2374 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3701,7 +3725,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2370 +#: ../../library/stdtypes.rst:2383 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, " @@ -3711,7 +3735,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2392 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3727,13 +3751,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2386 +#: ../../library/stdtypes.rst:2399 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2391 +#: ../../library/stdtypes.rst:2404 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3749,120 +3773,120 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2404 +#: ../../library/stdtypes.rst:2417 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:2408 +#: ../../library/stdtypes.rst:2421 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2425 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2425 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2427 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2427 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2429 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2429 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2418 +#: ../../library/stdtypes.rst:2431 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2418 +#: ../../library/stdtypes.rst:2431 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2420 +#: ../../library/stdtypes.rst:2433 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2420 +#: ../../library/stdtypes.rst:2433 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:2435 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:2435 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2437 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2437 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2439 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2439 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2428 +#: ../../library/stdtypes.rst:2441 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2428 +#: ../../library/stdtypes.rst:2441 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2443 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2443 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:2445 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:2445 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2447 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2447 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2439 +#: ../../library/stdtypes.rst:2452 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2443 +#: ../../library/stdtypes.rst:2456 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3874,14 +3898,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:2448 +#: ../../library/stdtypes.rst:2461 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:2452 +#: ../../library/stdtypes.rst:2465 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3893,11 +3917,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2457 +#: ../../library/stdtypes.rst:2470 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2472 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3909,7 +3933,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2480 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3917,7 +3941,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2488 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 " @@ -3926,7 +3950,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2494 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3938,7 +3962,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2486 +#: ../../library/stdtypes.rst:2499 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3946,7 +3970,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2492 +#: ../../library/stdtypes.rst:2505 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3956,20 +3980,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2499 +#: ../../library/stdtypes.rst:2512 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:2506 +#: ../../library/stdtypes.rst:2519 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:2511 +#: ../../library/stdtypes.rst:2524 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3977,7 +4001,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2514 ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3937 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 " @@ -3985,7 +4009,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2519 +#: ../../library/stdtypes.rst:2532 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3993,19 +4017,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2522 +#: ../../library/stdtypes.rst:2535 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2525 +#: ../../library/stdtypes.rst:2538 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2541 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4025,7 +4049,11 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2540 +#: ../../library/stdtypes.rst:2550 +msgid "See also :meth:`istitle`." +msgstr "另請參閱 :meth:`istitle`。" + +#: ../../library/stdtypes.rst:2555 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 " @@ -4037,19 +4065,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2564 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2552 +#: ../../library/stdtypes.rst:2567 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2573 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`` " @@ -4058,14 +4086,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2564 +#: ../../library/stdtypes.rst:2579 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2571 +#: ../../library/stdtypes.rst:2586 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 " @@ -4073,7 +4101,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2594 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -4085,27 +4113,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2600 +#: ../../library/stdtypes.rst:2615 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2603 +#: ../../library/stdtypes.rst:2618 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:2621 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2608 +#: ../../library/stdtypes.rst:2623 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2612 +#: ../../library/stdtypes.rst:2627 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -4115,7 +4143,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2635 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -4127,11 +4155,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2627 +#: ../../library/stdtypes.rst:2642 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2629 +#: ../../library/stdtypes.rst:2644 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -4141,13 +4169,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2635 +#: ../../library/stdtypes.rst:2650 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2638 +#: ../../library/stdtypes.rst:2653 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -4157,11 +4185,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2644 +#: ../../library/stdtypes.rst:2659 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2661 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -4171,12 +4199,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:2667 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2669 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -4186,11 +4214,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2675 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2677 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -4200,46 +4228,42 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2683 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:2687 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4116 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2674 +#: ../../library/stdtypes.rst:2689 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2674 +#: ../../library/stdtypes.rst:2689 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2690 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2690 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2679 -msgid "For example:" -msgstr "舉例來說:" - -#: ../../library/stdtypes.rst:2681 +#: ../../library/stdtypes.rst:2696 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -4259,7 +4283,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2707 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -4267,7 +4291,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2713 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -4287,7 +4311,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2709 +#: ../../library/stdtypes.rst:2724 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -4297,7 +4321,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2717 +#: ../../library/stdtypes.rst:2732 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -4305,19 +4329,24 @@ msgid "" ">>> f'{Fraction(1, 7):_^+10}'\n" "'___+1/7___'" msgstr "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" -#: ../../library/stdtypes.rst:2729 +#: ../../library/stdtypes.rst:2744 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2757 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 " "dictionaries correctly)." msgstr "" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2761 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4325,7 +4354,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2751 +#: ../../library/stdtypes.rst:2766 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4335,13 +4364,15 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2773 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." -#: ../../library/stdtypes.rst:2763 +#: ../../library/stdtypes.rst:2778 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 " @@ -4349,36 +4380,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2773 ../../library/stdtypes.rst:4033 +#: ../../library/stdtypes.rst:2788 ../../library/stdtypes.rst:4048 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2776 ../../library/stdtypes.rst:4036 +#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4051 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2778 ../../library/stdtypes.rst:4038 +#: ../../library/stdtypes.rst:2793 ../../library/stdtypes.rst:4053 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2781 ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:2796 ../../library/stdtypes.rst:4056 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2784 ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:2799 ../../library/stdtypes.rst:4059 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:2788 ../../library/stdtypes.rst:4048 +#: ../../library/stdtypes.rst:2803 ../../library/stdtypes.rst:4063 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4386,15 +4417,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2793 ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:2808 ../../library/stdtypes.rst:4068 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2795 ../../library/stdtypes.rst:4055 +#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:4070 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2797 +#: ../../library/stdtypes.rst:2812 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 " @@ -4402,275 +4433,275 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2806 ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:2821 ../../library/stdtypes.rst:4081 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2809 ../../library/stdtypes.rst:4069 +#: ../../library/stdtypes.rst:2824 ../../library/stdtypes.rst:4084 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:4078 +#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:4093 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 +#: ../../library/stdtypes.rst:2840 ../../library/stdtypes.rst:4100 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 +#: ../../library/stdtypes.rst:2840 ../../library/stdtypes.rst:4100 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:2846 ../../library/stdtypes.rst:4106 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:2846 ../../library/stdtypes.rst:4106 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:2850 ../../library/stdtypes.rst:4110 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:2838 ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 +#: ../../library/stdtypes.rst:2858 ../../library/stdtypes.rst:4118 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:2845 -#: ../../library/stdtypes.rst:4103 ../../library/stdtypes.rst:4105 +#: ../../library/stdtypes.rst:2858 ../../library/stdtypes.rst:2860 +#: ../../library/stdtypes.rst:4118 ../../library/stdtypes.rst:4120 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2845 ../../library/stdtypes.rst:4105 +#: ../../library/stdtypes.rst:2860 ../../library/stdtypes.rst:4120 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2868 ../../library/stdtypes.rst:4128 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2868 ../../library/stdtypes.rst:4128 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:4132 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:4132 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:4119 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4134 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:2861 -#: ../../library/stdtypes.rst:4119 ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:2876 +#: ../../library/stdtypes.rst:4134 ../../library/stdtypes.rst:4136 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:2876 ../../library/stdtypes.rst:4136 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 +#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 +#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 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:2867 ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4142 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4142 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:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2886 ../../library/stdtypes.rst:4146 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:2886 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:2889 ../../library/stdtypes.rst:4159 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2889 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2877 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:4153 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:2892 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4156 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:2895 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2890 ../../library/stdtypes.rst:4154 +#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4169 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2894 ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4173 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:2898 ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4177 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2901 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2916 ../../library/stdtypes.rst:4180 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2920 ../../library/stdtypes.rst:4184 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:2908 ../../library/stdtypes.rst:4172 +#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4187 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2912 ../../library/stdtypes.rst:4176 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4191 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4185 +#: ../../library/stdtypes.rst:2930 ../../library/stdtypes.rst:4200 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2917 +#: ../../library/stdtypes.rst:2932 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:2922 +#: ../../library/stdtypes.rst:2937 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2948 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2956 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 :" @@ -4678,17 +4709,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2961 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:2952 +#: ../../library/stdtypes.rst:2967 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2956 +#: ../../library/stdtypes.rst:2971 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4696,40 +4727,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2964 +#: ../../library/stdtypes.rst:2979 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:2967 +#: ../../library/stdtypes.rst:2982 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2983 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2969 +#: ../../library/stdtypes.rst:2984 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2986 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:2975 +#: ../../library/stdtypes.rst:2990 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:2979 +#: ../../library/stdtypes.rst:2994 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4742,29 +4773,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2989 +#: ../../library/stdtypes.rst:3004 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2992 +#: ../../library/stdtypes.rst:3007 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2993 +#: ../../library/stdtypes.rst:3008 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3009 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2996 +#: ../../library/stdtypes.rst:3011 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2998 +#: ../../library/stdtypes.rst:3013 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4772,38 +4803,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:3019 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:3011 +#: ../../library/stdtypes.rst:3026 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3015 +#: ../../library/stdtypes.rst:3030 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3034 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3131 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3046 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, " @@ -4812,13 +4843,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3048 +#: ../../library/stdtypes.rst:3063 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:3052 +#: ../../library/stdtypes.rst:3067 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 " @@ -4826,58 +4857,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3057 +#: ../../library/stdtypes.rst:3072 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:3065 +#: ../../library/stdtypes.rst:3080 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3069 +#: ../../library/stdtypes.rst:3084 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3075 +#: ../../library/stdtypes.rst:3090 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3078 +#: ../../library/stdtypes.rst:3093 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3094 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3080 +#: ../../library/stdtypes.rst:3095 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3081 +#: ../../library/stdtypes.rst:3096 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3083 +#: ../../library/stdtypes.rst:3098 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:3087 +#: ../../library/stdtypes.rst:3102 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3089 +#: ../../library/stdtypes.rst:3104 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4885,64 +4916,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3095 +#: ../../library/stdtypes.rst:3110 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:3102 +#: ../../library/stdtypes.rst:3117 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3106 +#: ../../library/stdtypes.rst:3121 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3110 +#: ../../library/stdtypes.rst:3125 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3124 +#: ../../library/stdtypes.rst:3139 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:3131 +#: ../../library/stdtypes.rst:3146 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:3149 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3136 +#: ../../library/stdtypes.rst:3151 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3155 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3148 +#: ../../library/stdtypes.rst:3163 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3161 +#: ../../library/stdtypes.rst:3176 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 " @@ -4950,7 +4981,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3166 +#: ../../library/stdtypes.rst:3181 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4958,11 +4989,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3175 +#: ../../library/stdtypes.rst:3190 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3180 +#: ../../library/stdtypes.rst:3195 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4971,14 +5002,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3188 +#: ../../library/stdtypes.rst:3203 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:3192 +#: ../../library/stdtypes.rst:3207 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4986,11 +5017,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3195 +#: ../../library/stdtypes.rst:3210 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3197 +#: ../../library/stdtypes.rst:3212 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4998,60 +5029,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3215 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:3205 +#: ../../library/stdtypes.rst:3220 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:3208 +#: ../../library/stdtypes.rst:3223 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3229 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:3218 ../../library/stdtypes.rst:3323 -#: ../../library/stdtypes.rst:3345 ../../library/stdtypes.rst:3411 -#: ../../library/stdtypes.rst:3424 +#: ../../library/stdtypes.rst:3233 ../../library/stdtypes.rst:3338 +#: ../../library/stdtypes.rst:3360 ../../library/stdtypes.rst:3426 +#: ../../library/stdtypes.rst:3439 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:3221 +#: ../../library/stdtypes.rst:3236 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:3224 ../../library/stdtypes.rst:3335 -#: ../../library/stdtypes.rst:3348 ../../library/stdtypes.rst:3414 -#: ../../library/stdtypes.rst:3427 +#: ../../library/stdtypes.rst:3239 ../../library/stdtypes.rst:3350 +#: ../../library/stdtypes.rst:3363 ../../library/stdtypes.rst:3429 +#: ../../library/stdtypes.rst:3442 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3231 +#: ../../library/stdtypes.rst:3246 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:3235 +#: ../../library/stdtypes.rst:3250 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5063,32 +5094,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3255 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3266 -#: ../../library/stdtypes.rst:3399 ../../library/stdtypes.rst:3492 -#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3536 -#: ../../library/stdtypes.rst:3550 ../../library/stdtypes.rst:3591 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3679 -#: ../../library/stdtypes.rst:3707 ../../library/stdtypes.rst:3846 -#: ../../library/stdtypes.rst:3901 ../../library/stdtypes.rst:3944 -#: ../../library/stdtypes.rst:3965 ../../library/stdtypes.rst:3987 -#: ../../library/stdtypes.rst:4189 +#: ../../library/stdtypes.rst:3259 ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3414 ../../library/stdtypes.rst:3507 +#: ../../library/stdtypes.rst:3521 ../../library/stdtypes.rst:3551 +#: ../../library/stdtypes.rst:3565 ../../library/stdtypes.rst:3606 +#: ../../library/stdtypes.rst:3676 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3722 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:3916 ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3980 ../../library/stdtypes.rst:4002 +#: ../../library/stdtypes.rst:4204 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:3253 +#: ../../library/stdtypes.rst:3268 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:3257 +#: ../../library/stdtypes.rst:3272 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5100,15 +5131,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3262 +#: ../../library/stdtypes.rst:3277 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3275 +#: ../../library/stdtypes.rst:3290 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3280 +#: ../../library/stdtypes.rst:3295 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5116,21 +5147,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3301 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:3292 +#: ../../library/stdtypes.rst:3307 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:3307 +#: ../../library/stdtypes.rst:3322 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5138,11 +5169,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3312 +#: ../../library/stdtypes.rst:3327 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3333 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 " @@ -5150,14 +5181,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3328 +#: ../../library/stdtypes.rst:3343 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:3332 +#: ../../library/stdtypes.rst:3347 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5165,13 +5196,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3342 +#: ../../library/stdtypes.rst:3357 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3370 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 " @@ -5181,7 +5212,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3366 +#: ../../library/stdtypes.rst:3381 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 " @@ -5189,7 +5220,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3377 +#: ../../library/stdtypes.rst:3392 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 " @@ -5198,24 +5229,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3384 ../../library/stdtypes.rst:3441 +#: ../../library/stdtypes.rst:3399 ../../library/stdtypes.rst:3456 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3390 +#: ../../library/stdtypes.rst:3405 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:3394 +#: ../../library/stdtypes.rst:3409 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3406 +#: ../../library/stdtypes.rst:3421 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5223,13 +5254,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3421 +#: ../../library/stdtypes.rst:3436 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3434 +#: ../../library/stdtypes.rst:3449 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 " @@ -5238,7 +5269,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3447 +#: ../../library/stdtypes.rst:3462 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5246,11 +5277,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3452 +#: ../../library/stdtypes.rst:3467 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3473 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 " @@ -5258,18 +5289,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3463 +#: ../../library/stdtypes.rst:3478 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3481 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:3484 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5277,11 +5308,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:3487 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3476 +#: ../../library/stdtypes.rst:3491 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 " @@ -5290,7 +5321,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3485 +#: ../../library/stdtypes.rst:3500 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). " @@ -5298,7 +5329,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3514 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). " @@ -5306,7 +5337,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3513 +#: ../../library/stdtypes.rst:3528 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5315,7 +5346,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:3534 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5327,14 +5358,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3524 +#: ../../library/stdtypes.rst:3539 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:3529 +#: ../../library/stdtypes.rst:3544 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5346,7 +5377,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:3558 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). " @@ -5354,7 +5385,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3572 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 " @@ -5364,7 +5395,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3568 +#: ../../library/stdtypes.rst:3583 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5373,7 +5404,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:3589 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5385,14 +5416,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:3594 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:3584 +#: ../../library/stdtypes.rst:3599 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5404,7 +5435,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3613 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 " @@ -5413,7 +5444,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3619 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',')`` " @@ -5424,7 +5455,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3614 +#: ../../library/stdtypes.rst:3629 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5444,7 +5475,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3638 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 " @@ -5454,7 +5485,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:3648 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5470,7 +5501,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3644 +#: ../../library/stdtypes.rst:3659 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5479,7 +5510,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:3666 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5491,13 +5522,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:3671 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:3680 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 " @@ -5505,14 +5536,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:3688 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:3686 +#: ../../library/stdtypes.rst:3701 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 " @@ -5528,7 +5559,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3700 +#: ../../library/stdtypes.rst:3715 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5540,7 +5571,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3714 +#: ../../library/stdtypes.rst:3729 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5549,7 +5580,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:3737 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5561,7 +5592,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3731 +#: ../../library/stdtypes.rst:3746 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5569,7 +5600,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3738 +#: ../../library/stdtypes.rst:3753 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5581,20 +5612,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3747 +#: ../../library/stdtypes.rst:3762 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:3757 +#: ../../library/stdtypes.rst:3772 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:3763 +#: ../../library/stdtypes.rst:3778 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5606,13 +5637,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3787 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:3777 +#: ../../library/stdtypes.rst:3792 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5624,16 +5655,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3782 ../../library/stdtypes.rst:3824 -#: ../../library/stdtypes.rst:3840 ../../library/stdtypes.rst:3890 -#: ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3797 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:3855 ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:3974 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:3790 +#: ../../library/stdtypes.rst:3805 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5641,14 +5672,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:3814 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:3805 +#: ../../library/stdtypes.rst:3820 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5660,14 +5691,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3814 +#: ../../library/stdtypes.rst:3829 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:3819 +#: ../../library/stdtypes.rst:3834 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5679,13 +5710,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3847 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3852 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5693,7 +5724,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3857 +#: ../../library/stdtypes.rst:3872 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 " @@ -5701,7 +5732,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:3879 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5713,14 +5744,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:3869 +#: ../../library/stdtypes.rst:3884 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:3873 +#: ../../library/stdtypes.rst:3888 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5732,13 +5763,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3882 +#: ../../library/stdtypes.rst:3897 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:3887 +#: ../../library/stdtypes.rst:3902 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5746,7 +5777,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3894 +#: ../../library/stdtypes.rst:3909 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5754,14 +5785,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3923 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:3914 +#: ../../library/stdtypes.rst:3929 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5769,7 +5800,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3932 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5777,7 +5808,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3942 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5785,12 +5816,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:3930 +#: ../../library/stdtypes.rst:3945 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3932 +#: ../../library/stdtypes.rst:3947 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5812,13 +5843,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3951 +#: ../../library/stdtypes.rst:3966 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3956 +#: ../../library/stdtypes.rst:3971 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5826,7 +5857,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3972 +#: ../../library/stdtypes.rst:3987 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 " @@ -5835,7 +5866,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3980 +#: ../../library/stdtypes.rst:3995 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5847,11 +5878,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4009 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4011 +#: ../../library/stdtypes.rst:4026 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 " @@ -5859,7 +5890,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4031 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5869,7 +5900,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4023 +#: ../../library/stdtypes.rst:4038 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 " @@ -5877,7 +5908,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4072 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 " @@ -5885,77 +5916,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:4124 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:4146 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4149 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4149 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4153 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4156 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4159 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4159 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4179 +#: ../../library/stdtypes.rst:4194 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4197 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4209 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4216 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4203 +#: ../../library/stdtypes.rst:4218 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:4209 +#: ../../library/stdtypes.rst:4224 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:4213 +#: ../../library/stdtypes.rst:4228 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 " @@ -5963,32 +5994,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4218 +#: ../../library/stdtypes.rst:4233 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:4222 +#: ../../library/stdtypes.rst:4237 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4225 +#: ../../library/stdtypes.rst:4240 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4228 +#: ../../library/stdtypes.rst:4243 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4246 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6010,7 +6041,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4241 +#: ../../library/stdtypes.rst:4256 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 " @@ -6021,11 +6052,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4265 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4252 +#: ../../library/stdtypes.rst:4267 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6047,13 +6078,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4262 +#: ../../library/stdtypes.rst:4277 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:4280 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6093,14 +6124,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4283 +#: ../../library/stdtypes.rst:4298 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:4287 +#: ../../library/stdtypes.rst:4302 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6118,44 +6149,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4295 +#: ../../library/stdtypes.rst:4310 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:4299 +#: ../../library/stdtypes.rst:4314 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4303 +#: ../../library/stdtypes.rst:4318 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4306 +#: ../../library/stdtypes.rst:4321 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4309 +#: ../../library/stdtypes.rst:4324 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4328 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:4317 +#: ../../library/stdtypes.rst:4332 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:4320 +#: ../../library/stdtypes.rst:4335 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6189,14 +6220,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4336 +#: ../../library/stdtypes.rst:4351 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:4340 +#: ../../library/stdtypes.rst:4355 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6222,25 +6253,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4352 +#: ../../library/stdtypes.rst:4367 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4370 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4361 +#: ../../library/stdtypes.rst:4376 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:4364 +#: ../../library/stdtypes.rst:4379 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6254,7 +6285,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:4385 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6262,7 +6293,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4390 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' " @@ -6271,13 +6302,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4400 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4388 +#: ../../library/stdtypes.rst:4403 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6287,18 +6318,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4409 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:4401 +#: ../../library/stdtypes.rst:4416 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4418 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6316,19 +6347,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4426 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:4418 +#: ../../library/stdtypes.rst:4433 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4436 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6354,7 +6385,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4437 +#: ../../library/stdtypes.rst:4452 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 :" @@ -6363,14 +6394,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4458 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:4447 +#: ../../library/stdtypes.rst:4462 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6386,13 +6417,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4469 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4472 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6412,7 +6443,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4486 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 " @@ -6421,7 +6452,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4492 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 " @@ -6429,11 +6460,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4483 +#: ../../library/stdtypes.rst:4498 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4485 +#: ../../library/stdtypes.rst:4500 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6477,11 +6508,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4521 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4508 +#: ../../library/stdtypes.rst:4523 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6505,11 +6536,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4534 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4521 +#: ../../library/stdtypes.rst:4536 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6559,11 +6590,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4560 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4547 +#: ../../library/stdtypes.rst:4562 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6585,33 +6616,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4559 +#: ../../library/stdtypes.rst:4574 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4564 +#: ../../library/stdtypes.rst:4579 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4570 +#: ../../library/stdtypes.rst:4585 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4573 +#: ../../library/stdtypes.rst:4588 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4592 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4596 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4583 +#: ../../library/stdtypes.rst:4598 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6623,14 +6654,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4592 +#: ../../library/stdtypes.rst:4607 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:4596 +#: ../../library/stdtypes.rst:4611 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6662,11 +6693,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4626 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4613 +#: ../../library/stdtypes.rst:4628 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6690,11 +6721,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4628 +#: ../../library/stdtypes.rst:4643 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4632 +#: ../../library/stdtypes.rst:4647 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 " @@ -6702,17 +6733,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4652 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:4643 +#: ../../library/stdtypes.rst:4658 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4660 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6732,49 +6763,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4656 +#: ../../library/stdtypes.rst:4671 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4661 +#: ../../library/stdtypes.rst:4676 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:4664 ../../library/stdtypes.rst:4672 +#: ../../library/stdtypes.rst:4679 ../../library/stdtypes.rst:4687 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4669 +#: ../../library/stdtypes.rst:4684 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:4677 +#: ../../library/stdtypes.rst:4692 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4681 +#: ../../library/stdtypes.rst:4696 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4687 +#: ../../library/stdtypes.rst:4702 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4708 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4701 +#: ../../library/stdtypes.rst:4716 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4720 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6784,7 +6815,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4712 +#: ../../library/stdtypes.rst:4727 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 " @@ -6792,7 +6823,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4717 +#: ../../library/stdtypes.rst:4732 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -6804,18 +6835,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4725 +#: ../../library/stdtypes.rst:4740 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:4729 +#: ../../library/stdtypes.rst:4744 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4734 +#: ../../library/stdtypes.rst:4749 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 " @@ -6823,92 +6854,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4755 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4742 +#: ../../library/stdtypes.rst:4757 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4758 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4744 +#: ../../library/stdtypes.rst:4759 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4746 +#: ../../library/stdtypes.rst:4761 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4766 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4755 +#: ../../library/stdtypes.rst:4770 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4759 +#: ../../library/stdtypes.rst:4774 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4763 +#: ../../library/stdtypes.rst:4778 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:4769 +#: ../../library/stdtypes.rst:4784 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:4788 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4779 +#: ../../library/stdtypes.rst:4794 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4798 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:4804 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4794 +#: ../../library/stdtypes.rst:4809 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4799 +#: ../../library/stdtypes.rst:4814 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4819 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4808 +#: ../../library/stdtypes.rst:4823 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4811 +#: ../../library/stdtypes.rst:4826 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6918,7 +6949,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4818 +#: ../../library/stdtypes.rst:4833 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 " @@ -6928,14 +6959,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4825 +#: ../../library/stdtypes.rst:4840 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:4829 +#: ../../library/stdtypes.rst:4844 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 " @@ -6943,71 +6974,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4849 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:4837 +#: ../../library/stdtypes.rst:4852 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4839 +#: ../../library/stdtypes.rst:4854 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:4843 +#: ../../library/stdtypes.rst:4858 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4849 +#: ../../library/stdtypes.rst:4864 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4854 +#: ../../library/stdtypes.rst:4869 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4859 +#: ../../library/stdtypes.rst:4874 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4879 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4868 +#: ../../library/stdtypes.rst:4883 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4872 +#: ../../library/stdtypes.rst:4887 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4877 +#: ../../library/stdtypes.rst:4892 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4881 +#: ../../library/stdtypes.rst:4896 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4886 +#: ../../library/stdtypes.rst:4901 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4889 +#: ../../library/stdtypes.rst:4904 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -7015,18 +7046,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4894 +#: ../../library/stdtypes.rst:4909 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:4903 +#: ../../library/stdtypes.rst:4918 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4928 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7035,7 +7066,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4934 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7044,33 +7075,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4945 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4948 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4935 +#: ../../library/stdtypes.rst:4950 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:4937 +#: ../../library/stdtypes.rst:4952 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4953 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4941 +#: ../../library/stdtypes.rst:4956 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 " @@ -7083,7 +7114,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4951 +#: ../../library/stdtypes.rst:4966 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 " @@ -7091,13 +7122,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4956 ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:4971 ../../library/stdtypes.rst:4989 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:4959 +#: ../../library/stdtypes.rst:4974 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7106,7 +7137,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:4980 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7126,13 +7157,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:4992 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:4980 +#: ../../library/stdtypes.rst:4995 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7164,33 +7195,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4995 +#: ../../library/stdtypes.rst:5010 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5014 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5004 +#: ../../library/stdtypes.rst:5019 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5008 +#: ../../library/stdtypes.rst:5023 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5012 +#: ../../library/stdtypes.rst:5027 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5032 msgid "" "If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " "is not present, the ``d[key]`` operation calls that method with the key " @@ -7201,7 +7232,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5040 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7225,51 +7256,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5051 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different :meth:`!__missing__` method is used by :class:" "`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5058 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5062 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5067 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5071 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5075 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5080 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5084 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5088 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5090 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 " @@ -7278,70 +7309,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5098 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:5089 +#: ../../library/stdtypes.rst:5104 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5109 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5100 +#: ../../library/stdtypes.rst:5115 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:5106 +#: ../../library/stdtypes.rst:5121 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:5109 +#: ../../library/stdtypes.rst:5124 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:5113 +#: ../../library/stdtypes.rst:5128 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5134 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5141 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:5134 +#: ../../library/stdtypes.rst:5149 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5137 +#: ../../library/stdtypes.rst:5152 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7350,20 +7381,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5160 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5163 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:5152 +#: ../../library/stdtypes.rst:5167 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7373,25 +7404,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5173 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:5166 +#: ../../library/stdtypes.rst:5181 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:5172 +#: ../../library/stdtypes.rst:5187 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5189 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7413,21 +7444,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5199 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5204 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5196 +#: ../../library/stdtypes.rst:5211 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5213 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 " @@ -7435,23 +7466,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5218 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5223 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5227 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5230 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7459,39 +7490,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5220 +#: ../../library/stdtypes.rst:5235 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:5223 +#: ../../library/stdtypes.rst:5238 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5228 +#: ../../library/stdtypes.rst:5243 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:5233 +#: ../../library/stdtypes.rst:5248 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:5236 +#: ../../library/stdtypes.rst:5251 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5256 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5261 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 " @@ -7505,11 +7536,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5273 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5275 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7550,11 +7581,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5317 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5324 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 " @@ -7565,7 +7596,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5332 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 " @@ -7576,7 +7607,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5337 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7585,7 +7616,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5326 +#: ../../library/stdtypes.rst:5341 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 " @@ -7599,7 +7630,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5351 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7611,7 +7642,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5356 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7626,7 +7657,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5348 +#: ../../library/stdtypes.rst:5363 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7638,7 +7669,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5354 +#: ../../library/stdtypes.rst:5369 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7650,7 +7681,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5360 +#: ../../library/stdtypes.rst:5375 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7665,7 +7696,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5367 +#: ../../library/stdtypes.rst:5382 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 " @@ -7677,7 +7708,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5390 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7685,7 +7716,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5395 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7693,11 +7724,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5402 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5408 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7713,7 +7744,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5418 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7721,7 +7752,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5406 +#: ../../library/stdtypes.rst:5421 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7729,7 +7760,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5424 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 " @@ -7741,7 +7772,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5430 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 " @@ -7753,7 +7784,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5436 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 " @@ -7765,7 +7796,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5427 +#: ../../library/stdtypes.rst:5442 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." @@ -7778,7 +7809,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5448 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7787,7 +7818,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5454 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7797,7 +7828,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5444 +#: ../../library/stdtypes.rst:5459 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7805,7 +7836,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5462 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 " @@ -7816,7 +7847,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5467 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7824,7 +7855,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5455 +#: ../../library/stdtypes.rst:5470 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7832,7 +7863,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5458 +#: ../../library/stdtypes.rst:5473 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7844,7 +7875,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5478 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7856,7 +7887,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5469 +#: ../../library/stdtypes.rst:5484 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7866,13 +7897,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5488 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5491 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7890,13 +7921,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5499 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5486 +#: ../../library/stdtypes.rst:5501 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7910,7 +7941,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5507 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7918,7 +7949,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5495 +#: ../../library/stdtypes.rst:5510 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7930,7 +7961,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5515 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7940,7 +7971,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5519 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7952,253 +7983,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5511 +#: ../../library/stdtypes.rst:5526 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5528 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5531 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5517 +#: ../../library/stdtypes.rst:5532 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5518 +#: ../../library/stdtypes.rst:5533 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5519 +#: ../../library/stdtypes.rst:5534 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5535 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5536 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5522 +#: ../../library/stdtypes.rst:5537 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5538 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5539 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5540 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5541 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5527 +#: ../../library/stdtypes.rst:5542 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5543 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5544 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5545 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5531 +#: ../../library/stdtypes.rst:5546 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5547 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5548 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5549 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5535 +#: ../../library/stdtypes.rst:5550 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5536 +#: ../../library/stdtypes.rst:5551 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5552 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5553 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5554 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5555 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5556 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5557 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5543 +#: ../../library/stdtypes.rst:5558 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5559 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5560 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5561 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5562 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5563 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5564 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5565 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5566 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5567 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5568 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5569 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5570 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5571 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5572 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5573 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5559 +#: ../../library/stdtypes.rst:5574 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5575 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5576 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5577 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5578 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5579 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5580 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5581 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5582 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5583 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5584 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5570 +#: ../../library/stdtypes.rst:5585 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5571 +#: ../../library/stdtypes.rst:5586 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5591 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5578 +#: ../../library/stdtypes.rst:5593 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5597 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5584 +#: ../../library/stdtypes.rst:5599 msgid "" ">>> list[int].__origin__\n" "" @@ -8206,7 +8237,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5605 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 " @@ -8215,7 +8246,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5609 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8223,7 +8254,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5615 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8231,7 +8262,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5618 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8245,7 +8276,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5626 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8255,7 +8286,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5633 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8263,19 +8294,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5641 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5642 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5644 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5645 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8284,7 +8315,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5649 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8292,18 +8323,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5650 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:5644 +#: ../../library/stdtypes.rst:5659 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5665 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8316,7 +8347,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5657 +#: ../../library/stdtypes.rst:5672 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 " @@ -8327,7 +8358,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5662 +#: ../../library/stdtypes.rst:5677 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8335,7 +8366,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5682 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 " @@ -8348,40 +8379,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5690 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5692 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5694 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5681 +#: ../../library/stdtypes.rst:5696 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5698 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5685 +#: ../../library/stdtypes.rst:5700 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5702 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5704 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`types.UnionType` 的實例: ::" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5706 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8389,21 +8420,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5709 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5711 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5716 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5704 +#: ../../library/stdtypes.rst:5719 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8411,14 +8442,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5722 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5710 +#: ../../library/stdtypes.rst:5725 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8428,7 +8459,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5732 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8436,7 +8467,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5720 +#: ../../library/stdtypes.rst:5735 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8454,7 +8485,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5729 +#: ../../library/stdtypes.rst:5744 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 " @@ -8463,7 +8494,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5733 +#: ../../library/stdtypes.rst:5748 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8489,32 +8520,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5764 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5770 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5777 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5764 +#: ../../library/stdtypes.rst:5779 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5786 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5773 +#: ../../library/stdtypes.rst:5788 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 " @@ -8525,7 +8556,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5780 +#: ../../library/stdtypes.rst:5795 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8536,32 +8567,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5788 +#: ../../library/stdtypes.rst:5803 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5796 +#: ../../library/stdtypes.rst:5811 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5798 +#: ../../library/stdtypes.rst:5813 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5819 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5821 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:5809 +#: ../../library/stdtypes.rst:5824 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8569,15 +8600,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5828 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5834 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5838 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8585,7 +8616,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5844 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:" @@ -8598,7 +8629,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5855 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8609,7 +8640,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5848 +#: ../../library/stdtypes.rst:5863 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8637,15 +8668,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5863 +#: ../../library/stdtypes.rst:5878 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5871 +#: ../../library/stdtypes.rst:5886 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5877 +#: ../../library/stdtypes.rst:5892 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8655,7 +8686,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5899 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8664,21 +8695,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5891 +#: ../../library/stdtypes.rst:5906 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:5894 +#: ../../library/stdtypes.rst:5909 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5915 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5906 +#: ../../library/stdtypes.rst:5921 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 " @@ -8686,94 +8717,94 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5911 +#: ../../library/stdtypes.rst:5926 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5917 +#: ../../library/stdtypes.rst:5932 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5919 +#: ../../library/stdtypes.rst:5934 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:5923 +#: ../../library/stdtypes.rst:5938 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5930 +#: ../../library/stdtypes.rst:5945 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5947 msgid "" -"This object is commonly used used to indicate that something is omitted. It " +"This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " "named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5937 +#: ../../library/stdtypes.rst:5952 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5939 +#: ../../library/stdtypes.rst:5954 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:5942 +#: ../../library/stdtypes.rst:5957 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:5945 +#: ../../library/stdtypes.rst:5960 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:5947 +#: ../../library/stdtypes.rst:5962 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:5950 +#: ../../library/stdtypes.rst:5965 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5967 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:5954 +#: ../../library/stdtypes.rst:5969 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:5956 +#: ../../library/stdtypes.rst:5971 msgid "" "Lastly, the Python documentation often uses three dots in conventional " "English usage to mean omitted content, even in code examples that also use " "them as the ``Ellipsis``." msgstr "" -#: ../../library/stdtypes.rst:5964 +#: ../../library/stdtypes.rst:5979 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5966 +#: ../../library/stdtypes.rst:5981 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 " @@ -8781,64 +8812,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5971 +#: ../../library/stdtypes.rst:5986 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:5977 +#: ../../library/stdtypes.rst:5992 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5979 +#: ../../library/stdtypes.rst:5994 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6002 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5989 +#: ../../library/stdtypes.rst:6004 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:5996 +#: ../../library/stdtypes.rst:6011 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6002 +#: ../../library/stdtypes.rst:6017 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6010 +#: ../../library/stdtypes.rst:6025 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6030 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6020 +#: ../../library/stdtypes.rst:6035 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:6030 +#: ../../library/stdtypes.rst:6045 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6032 +#: ../../library/stdtypes.rst:6047 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 " @@ -8846,7 +8877,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6037 +#: ../../library/stdtypes.rst:6052 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 " @@ -8856,24 +8887,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6044 +#: ../../library/stdtypes.rst:6059 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6046 +#: ../../library/stdtypes.rst:6061 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:6050 +#: ../../library/stdtypes.rst:6065 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6052 +#: ../../library/stdtypes.rst:6067 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8897,7 +8928,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6072 +#: ../../library/stdtypes.rst:6087 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8905,11 +8936,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6077 +#: ../../library/stdtypes.rst:6092 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6079 +#: ../../library/stdtypes.rst:6094 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8927,84 +8958,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6092 +#: ../../library/stdtypes.rst:6107 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6094 +#: ../../library/stdtypes.rst:6109 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6097 +#: ../../library/stdtypes.rst:6112 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6098 +#: ../../library/stdtypes.rst:6113 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6099 +#: ../../library/stdtypes.rst:6114 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6100 +#: ../../library/stdtypes.rst:6115 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6101 +#: ../../library/stdtypes.rst:6116 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6104 +#: ../../library/stdtypes.rst:6119 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6106 +#: ../../library/stdtypes.rst:6121 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6122 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6108 +#: ../../library/stdtypes.rst:6123 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6109 +#: ../../library/stdtypes.rst:6124 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6110 +#: ../../library/stdtypes.rst:6125 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6111 +#: ../../library/stdtypes.rst:6126 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6114 +#: ../../library/stdtypes.rst:6129 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6116 +#: ../../library/stdtypes.rst:6131 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:6119 +#: ../../library/stdtypes.rst:6134 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:6122 +#: ../../library/stdtypes.rst:6137 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9012,7 +9043,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6124 +#: ../../library/stdtypes.rst:6139 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 " @@ -9021,38 +9052,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6130 +#: ../../library/stdtypes.rst:6145 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6133 +#: ../../library/stdtypes.rst:6148 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:6137 +#: ../../library/stdtypes.rst:6152 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6139 +#: ../../library/stdtypes.rst:6154 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6141 +#: ../../library/stdtypes.rst:6156 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:6148 +#: ../../library/stdtypes.rst:6163 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 " @@ -9064,7 +9095,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6157 +#: ../../library/stdtypes.rst:6172 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 " @@ -9072,11 +9103,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6163 +#: ../../library/stdtypes.rst:6178 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6180 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 " @@ -9084,11 +9115,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6185 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6187 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9110,38 +9141,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6182 +#: ../../library/stdtypes.rst:6197 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6186 +#: ../../library/stdtypes.rst:6201 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6187 +#: ../../library/stdtypes.rst:6202 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6190 +#: ../../library/stdtypes.rst:6205 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6193 +#: ../../library/stdtypes.rst:6208 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6195 +#: ../../library/stdtypes.rst:6210 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:6198 +#: ../../library/stdtypes.rst:6213 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9154,13 +9185,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:322 #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5917 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "statement" msgstr "statement(陳述式)" @@ -9282,11 +9313,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1366 #: ../../library/stdtypes.rst:1445 ../../library/stdtypes.rst:1489 #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:2954 -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4703 -#: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5389 -#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5821 -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:2969 +#: ../../library/stdtypes.rst:3082 ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4920 ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5661 ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5881 msgid "object" msgstr "object(物件)" @@ -9378,9 +9409,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 -#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5873 ../../library/stdtypes.rst:5887 -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5888 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:5917 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9396,8 +9427,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4086 msgid "+ (plus)" msgstr "+ (加號)" @@ -9409,13 +9440,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4086 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2768 -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2783 +#: ../../library/stdtypes.rst:4043 msgid "* (asterisk)" msgstr "* (星號)" @@ -9427,8 +9458,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2731 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:4011 msgid "% (percent)" msgstr "% (百分號)" @@ -9438,7 +9469,7 @@ msgstr "**" #: ../../library/stdtypes.rst:322 ../../library/stdtypes.rst:399 #: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "operations on" msgstr "operations on(操作於)" @@ -9447,7 +9478,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:5917 msgid "module" msgstr "模組" @@ -9515,7 +9546,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5319 msgid "protocol" msgstr "protocol(協定)" @@ -9541,7 +9572,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4920 msgid "len" msgstr "len" @@ -9610,14 +9641,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:3177 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:3082 ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:4011 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5661 ../../library/stdtypes.rst:5917 msgid "type" msgstr "type(型別)" @@ -9625,7 +9656,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 msgid "del" msgstr "del" @@ -9634,8 +9665,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2585 -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2600 +#: ../../library/stdtypes.rst:2746 msgid "string" msgstr "string(字串)" @@ -9656,17 +9687,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2942 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:2954 ../../library/stdtypes.rst:3177 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:4011 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3192 msgid "methods" msgstr "methods(方法)" @@ -9674,239 +9705,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2399 ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:2412 ../../library/stdtypes.rst:3865 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2412 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:2746 ../../library/stdtypes.rst:4011 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:2746 ../../library/stdtypes.rst:4011 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:4043 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4028 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4043 ../../library/stdtypes.rst:4086 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:4043 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:4086 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:4086 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:2942 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:2950 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:2950 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3865 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3865 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4718 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5030 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5392 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5392 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5661 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5661 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5836 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5881 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5881 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5888 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5888 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5926 +#: ../../library/stdtypes.rst:5941 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5926 +#: ../../library/stdtypes.rst:5941 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/string.po b/library/string.po index b4e0ea7563..22619bfacd 100644 --- a/library/string.po +++ b/library/string.po @@ -1032,6 +1032,12 @@ msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(**coord)\n" "'Coordinates: 37.24N, -115.81W'" msgstr "" +">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " +"longitude='-115.81W')\n" +"'Coordinates: 37.24N, -115.81W'\n" +">>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}\n" +">>> 'Coordinates: {latitude}, {longitude}'.format(**coord)\n" +"'Coordinates: 37.24N, -115.81W'" #: ../../library/string.rst:678 msgid "Accessing arguments' attributes::" diff --git a/library/string.templatelib.po b/library/string.templatelib.po index 6986f76fb4..372d2f8578 100644 --- a/library/string.templatelib.po +++ b/library/string.templatelib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-06 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,7 +26,7 @@ msgstr "**原始碼:**\\ :source:`Lib/string/templatelib.py`" #: ../../library/string.templatelib.rst:13 msgid ":ref:`Format strings `" -msgstr "" +msgstr ":ref:`格式字串 `" #: ../../library/string.templatelib.rst:14 msgid ":ref:`Template string literal (t-string) syntax `" @@ -43,9 +43,9 @@ msgstr "模板字串" #: ../../library/string.templatelib.rst:24 msgid "" "Template strings are a mechanism for custom string processing. They have the " -"full flexibility of Python's :ref:`f-strings`, but return " -"a :class:`Template` instance that gives access to the static and " -"interpolated (in curly braces) parts of a string *before* they are combined." +"full flexibility of Python's :ref:`f-strings`, but return a :class:" +"`Template` instance that gives access to the static and interpolated (in " +"curly brackets) parts of a string *before* they are combined." msgstr "" #: ../../library/string.templatelib.rst:30 @@ -81,10 +81,10 @@ msgstr "" #: ../../library/string.templatelib.rst:49 msgid "" -"The most common way to create a :class:`!Template` instance is to use " -"the :ref:`template string literal syntax `. This syntax is " -"identical to that of :ref:`f-strings `, except that it uses a " -"``t`` prefix in place of an ``f``:" +"The most common way to create a :class:`!Template` instance is to use the :" +"ref:`template string literal syntax `. This syntax is identical " +"to that of :ref:`f-strings `, except that it uses a ``t`` prefix " +"in place of an ``f``:" msgstr "" #: ../../library/string.templatelib.rst:59 @@ -145,12 +145,12 @@ msgstr "" #: ../../library/string.templatelib.rst:139 msgid "" "The ``values`` tuple always has the same length as the ``interpolations`` " -"tuple. It is always equivalent to ``tuple(i.value for i in " -"template.interpolations)``." +"tuple. It is always equivalent to ``tuple(i.value for i in template." +"interpolations)``." msgstr "" #: ../../library/string.templatelib.rst:144 -#: ../../library/string.templatelib.rst:314 +#: ../../library/string.templatelib.rst:317 msgid "Methods" msgstr "方法" @@ -177,8 +177,8 @@ msgstr "" #: ../../library/string.templatelib.rst:182 msgid "" -"Iterate over the template, yielding each non-empty string " -"and :class:`Interpolation` in the correct order:" +"Iterate over the template, yielding each non-empty string and :class:" +"`Interpolation` in the correct order:" msgstr "" #: ../../library/string.templatelib.rst:191 @@ -219,28 +219,32 @@ msgid "The evaluated value of the interpolation." msgstr "" #: ../../library/string.templatelib.rst:261 -#: ../../library/string.templatelib.rst:323 -msgid "The text of a valid Python expression, or an empty string." +msgid "" +"For interpolations created by t-string literals, :attr:`!expression` is the " +"expression text found inside the curly brackets (``{`` & ``}``), including " +"any whitespace, excluding the curly brackets themselves, and ending before " +"the first ``!``, ``:``, or ``=`` if any is present. For manually created " +"interpolations, :attr:`!expression` is the arbitrary string provided when " +"constructing the interpolation instance." msgstr "" -#: ../../library/string.templatelib.rst:263 +#: ../../library/string.templatelib.rst:268 msgid "" -"The :attr:`.expression` is the original text of the interpolation's Python " -"expression, if the interpolation was created from a t-string literal. " -"Developers creating interpolations manually should either set this to an " -"empty string or choose a suitable valid Python expression." +"We recommend using valid Python expressions or the empty string for the " +"``expression`` field of manually created :class:`!Interpolation` instances, " +"although this is not enforced at runtime." msgstr "" -#: ../../library/string.templatelib.rst:275 +#: ../../library/string.templatelib.rst:278 msgid "The conversion to apply to the value, or ``None``." msgstr "" -#: ../../library/string.templatelib.rst:277 +#: ../../library/string.templatelib.rst:280 msgid "" "The :attr:`!conversion` is the optional conversion to apply to the value:" msgstr "" -#: ../../library/string.templatelib.rst:285 +#: ../../library/string.templatelib.rst:288 msgid "" "Unlike f-strings, where conversions are applied automatically, the expected " "behavior with t-strings is that code that *processes* the :class:`!Template` " @@ -249,17 +253,17 @@ msgid "" "conversion semantics." msgstr "" -#: ../../library/string.templatelib.rst:295 +#: ../../library/string.templatelib.rst:298 msgid "The format specification to apply to the value." msgstr "" -#: ../../library/string.templatelib.rst:297 +#: ../../library/string.templatelib.rst:300 msgid "" "The :attr:`!format_spec` is an optional, arbitrary string used as the format " "specification to present the value:" msgstr "" -#: ../../library/string.templatelib.rst:305 +#: ../../library/string.templatelib.rst:308 msgid "" "Unlike f-strings, where format specifications are applied automatically via " "the :func:`format` protocol, the expected behavior with t-strings is that " @@ -269,7 +273,7 @@ msgid "" "not conform to the :func:`format` protocol." msgstr "" -#: ../../library/string.templatelib.rst:320 +#: ../../library/string.templatelib.rst:323 msgid "Create a new :class:`!Interpolation` object from component parts." msgstr "" @@ -277,49 +281,53 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/string.templatelib.rst:322 +#: ../../library/string.templatelib.rst:325 msgid "The evaluated, in-scope result of the interpolation." msgstr "" -#: ../../library/string.templatelib.rst:325 +#: ../../library/string.templatelib.rst:326 +msgid "The text of a valid Python expression, or an empty string." +msgstr "" + +#: ../../library/string.templatelib.rst:328 msgid "" "The :ref:`conversion ` to be used, one of ``None``, ``'a'``, " "``'r'``, or ``'s'``." msgstr "" -#: ../../library/string.templatelib.rst:327 +#: ../../library/string.templatelib.rst:330 msgid "" "An optional, arbitrary string used as the :ref:`format specification " "` to present the value." msgstr "" -#: ../../library/string.templatelib.rst:332 +#: ../../library/string.templatelib.rst:335 msgid "Helper functions" msgstr "" -#: ../../library/string.templatelib.rst:336 +#: ../../library/string.templatelib.rst:339 msgid "" "Applies formatted string literal :ref:`conversion ` semantics to the given object *obj*. This is frequently useful " "for custom template string processing logic." msgstr "" -#: ../../library/string.templatelib.rst:340 +#: ../../library/string.templatelib.rst:343 msgid "Three conversion flags are currently supported:" msgstr "" -#: ../../library/string.templatelib.rst:342 +#: ../../library/string.templatelib.rst:345 msgid "``'s'`` which calls :func:`str` on the value (like ``!s``)," msgstr "" -#: ../../library/string.templatelib.rst:343 +#: ../../library/string.templatelib.rst:346 msgid "``'r'`` which calls :func:`repr` (like ``!r``), and" msgstr "" -#: ../../library/string.templatelib.rst:344 +#: ../../library/string.templatelib.rst:347 msgid "``'a'`` which calls :func:`ascii` (like ``!a``)." msgstr "" -#: ../../library/string.templatelib.rst:346 +#: ../../library/string.templatelib.rst:349 msgid "If the conversion flag is ``None``, *obj* is returned unchanged." msgstr "" diff --git a/library/subprocess.po b/library/subprocess.po index 3103546226..68ed5a8c6d 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-09 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -99,20 +99,19 @@ msgid "" "the internal :class:`Popen` object is automatically created with *stdout* " "and *stderr* both set to :data:`~subprocess.PIPE`. The *stdout* and *stderr* " "arguments may not be supplied at the same time as *capture_output*. If you " -"wish to capture and combine both streams into one, set *stdout* " -"to :data:`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, " -"instead of using *capture_output*." +"wish to capture and combine both streams into one, set *stdout* to :data:" +"`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " +"using *capture_output*." msgstr "" #: ../../library/subprocess.rst:62 msgid "" -"A *timeout* may be specified in seconds, it is internally passed on " -"to :meth:`Popen.communicate`. If the timeout expires, the child process will " -"be killed and waited for. The :exc:`TimeoutExpired` exception will be re-" -"raised after the child process has terminated. The initial process creation " -"itself cannot be interrupted on many platform APIs so you are not guaranteed " -"to see a timeout exception until at least after however long process " -"creation takes." +"A *timeout* may be specified in seconds, it is internally passed on to :meth:" +"`Popen.communicate`. If the timeout expires, the child process will be " +"killed and waited for. The :exc:`TimeoutExpired` exception will be re-raised " +"after the child process has terminated. The initial process creation itself " +"cannot be interrupted on many platform APIs so you are not guaranteed to see " +"a timeout exception until at least after however long process creation takes." msgstr "" #: ../../library/subprocess.rst:70 @@ -120,17 +119,16 @@ msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " "*encoding* or *errors* is specified or *text* is true. When used, the " -"internal :class:`Popen` object is automatically created with *stdin* set " -"to :data:`~subprocess.PIPE`, and the *stdin* argument may not be used as " -"well." +"internal :class:`Popen` object is automatically created with *stdin* set to :" +"data:`~subprocess.PIPE`, and the *stdin* argument may not be used as well." msgstr "" #: ../../library/subprocess.rst:77 msgid "" -"If *check* is true, and the process exits with a non-zero exit code, " -"a :exc:`CalledProcessError` exception will be raised. Attributes of that " -"exception hold the arguments, the exit code, and stdout and stderr if they " -"were captured." +"If *check* is true, and the process exits with a non-zero exit code, a :exc:" +"`CalledProcessError` exception will be raised. Attributes of that exception " +"hold the arguments, the exit code, and stdout and stderr if they were " +"captured." msgstr "" #: ../../library/subprocess.rst:82 @@ -148,8 +146,8 @@ msgid "" "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. It is passed " "directly to :class:`Popen`. This mapping can be str to str on any platform " -"or bytes to bytes on POSIX platforms much like :data:`os.environ` " -"or :data:`os.environb`." +"or bytes to bytes on POSIX platforms much like :data:`os.environ` or :data:" +"`os.environb`." msgstr "" #: ../../library/subprocess.rst:95 @@ -200,8 +198,8 @@ msgstr "" msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" -"\\System32\\cmd.exe``. As a result, dropping a malicious program named " -"``cmd.exe`` into a current directory no longer works." +"\\System32\\cmd.exe``. As a result, dropping a malicious program named ``cmd." +"exe`` into a current directory no longer works." msgstr "" #: ../../library/subprocess.rst:130 @@ -228,9 +226,9 @@ msgstr "" #: ../../library/subprocess.rst:146 msgid "" -"Captured stdout from the child process. A bytes sequence, or a string " -"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " -"if stdout was not captured." +"Captured stdout from the child process. A bytes sequence, or a string if :" +"func:`run` was called with an encoding, errors, or text=True. ``None`` if " +"stdout was not captured." msgstr "" #: ../../library/subprocess.rst:150 @@ -241,9 +239,9 @@ msgstr "" #: ../../library/subprocess.rst:156 msgid "" -"Captured stderr from the child process. A bytes sequence, or a string " -"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " -"if stderr was not captured." +"Captured stderr from the child process. A bytes sequence, or a string if :" +"func:`run` was called with an encoding, errors, or text=True. ``None`` if " +"stderr was not captured." msgstr "" #: ../../library/subprocess.rst:162 @@ -291,11 +289,10 @@ msgstr "" #: ../../library/subprocess.rst:211 msgid "" -"Output of the child process if it was captured by :func:`run` " -"or :func:`check_output`. Otherwise, ``None``. This is " -"always :class:`bytes` when any output was captured regardless of the " -"``text=True`` setting. It may remain ``None`` instead of ``b''`` when no " -"output was observed." +"Output of the child process if it was captured by :func:`run` or :func:" +"`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " +"any output was captured regardless of the ``text=True`` setting. It may " +"remain ``None`` instead of ``b''`` when no output was observed." msgstr "" #: ../../library/subprocess.rst:219 ../../library/subprocess.rst:256 @@ -316,9 +313,9 @@ msgstr "" #: ../../library/subprocess.rst:235 msgid "" -"Subclass of :exc:`SubprocessError`, raised when a process run " -"by :func:`check_call`, :func:`check_output`, or :func:`run` (with " -"``check=True``) returns a non-zero exit status." +"Subclass of :exc:`SubprocessError`, raised when a process run by :func:" +"`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " +"returns a non-zero exit status." msgstr "" #: ../../library/subprocess.rst:242 @@ -329,8 +326,8 @@ msgstr "" #: ../../library/subprocess.rst:251 msgid "" -"Output of the child process if it was captured by :func:`run` " -"or :func:`check_output`. Otherwise, ``None``." +"Output of the child process if it was captured by :func:`run` or :func:" +"`check_output`. Otherwise, ``None``." msgstr "" #: ../../library/subprocess.rst:260 @@ -369,10 +366,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special " -"file :data:`os.devnull` will be used. Additionally, *stderr* can " -"be :data:`STDOUT`, which indicates that the stderr data from the child " -"process should be captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special file :data:" +"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " +"which indicates that the stderr data from the child process should be " +"captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:299 @@ -409,9 +406,9 @@ msgstr "" #: ../../library/subprocess.rst:322 msgid "" -"The newlines attribute of the file " -"objects :attr:`Popen.stdin`, :attr:`Popen.stdout` and :attr:`Popen.stderr` " -"are not updated by the :meth:`Popen.communicate` method." +"The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." +"stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." +"communicate` method." msgstr "" #: ../../library/subprocess.rst:326 @@ -422,18 +419,17 @@ msgid "" "convenient access to other shell features such as shell pipes, filename " "wildcards, environment variable expansion, and expansion of ``~`` to a " "user's home directory. However, note that Python itself offers " -"implementations of many shell-like features (in " -"particular, :mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path.expanduser`, " -"and :mod:`shutil`)." +"implementations of many shell-like features (in particular, :mod:`glob`, :" +"mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path." +"expanduser`, and :mod:`shutil`)." msgstr "" #: ../../library/subprocess.rst:336 msgid "" -"When *universal_newlines* is ``True``, the class uses the " -"encoding :func:`locale.getpreferredencoding(False) " -"` instead of " -"``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` class " -"for more information on this change." +"When *universal_newlines* is ``True``, the class uses the encoding :func:" +"`locale.getpreferredencoding(False) ` instead " +"of ``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` " +"class for more information on this change." msgstr "" #: ../../library/subprocess.rst:344 ../../library/subprocess.rst:465 @@ -461,16 +457,16 @@ msgstr "" #: ../../library/subprocess.rst:368 msgid "" -"Execute a child program in a new process. On POSIX, the class " -"uses :meth:`os.execvpe`-like behavior to execute the child program. On " -"Windows, the class uses the Windows ``CreateProcess()`` function. The " -"arguments to :class:`Popen` are as follows." +"Execute a child program in a new process. On POSIX, the class uses :meth:" +"`os.execvpe`-like behavior to execute the child program. On Windows, the " +"class uses the Windows ``CreateProcess()`` function. The arguments to :" +"class:`Popen` are as follows." msgstr "" #: ../../library/subprocess.rst:373 msgid "" -"*args* should be a sequence of program arguments or else a single string " -"or :term:`path-like object`. By default, the program to execute is the first " +"*args* should be a sequence of program arguments or else a single string or :" +"term:`path-like object`. By default, the program to execute is the first " "item in *args* if *args* is a sequence. If *args* is a string, the " "interpretation is platform-dependent and described below. See the *shell* " "and *executable* arguments for additional differences from the default " @@ -590,8 +586,8 @@ msgid "" "when typed at the shell prompt. This includes, for example, quoting or " "backslash escaping filenames with spaces in them. If *args* is a sequence, " "the first item specifies the command string, and any additional items will " -"be treated as additional arguments to the shell itself. That is to " -"say, :class:`Popen` does the equivalent of::" +"be treated as additional arguments to the shell itself. That is to say, :" +"class:`Popen` does the equivalent of::" msgstr "" #: ../../library/subprocess.rst:455 @@ -631,8 +627,8 @@ msgstr "" #: ../../library/subprocess.rst:477 msgid "" -"negative bufsize (the default) means the system default of " -"io.DEFAULT_BUFFER_SIZE will be used." +"negative bufsize (the default) means the system default of io." +"DEFAULT_BUFFER_SIZE will be used." msgstr "" #: ../../library/subprocess.rst:480 @@ -675,10 +671,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special " -"file :data:`os.devnull` will be used. Additionally, *stderr* can " -"be :data:`STDOUT`, which indicates that the stderr data from the " -"applications should be captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special file :data:" +"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " +"which indicates that the stderr data from the applications should be " +"captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:523 @@ -720,8 +716,8 @@ msgstr "" #: ../../library/subprocess.rst:552 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " -"child process unless explicitly passed in the ``handle_list`` element " -"of :attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." +"child process unless explicitly passed in the ``handle_list`` element of :" +"attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" #: ../../library/subprocess.rst:556 @@ -732,16 +728,16 @@ msgstr "" #: ../../library/subprocess.rst:560 msgid "" -"On Windows the default for *close_fds* was changed from :const:`False` " -"to :const:`True` when redirecting the standard handles. It's now possible to " -"set *close_fds* to :const:`True` when redirecting the standard handles." +"On Windows the default for *close_fds* was changed from :const:`False` to :" +"const:`True` when redirecting the standard handles. It's now possible to set " +"*close_fds* to :const:`True` when redirecting the standard handles." msgstr "" #: ../../library/subprocess.rst:565 msgid "" "*pass_fds* is an optional sequence of file descriptors to keep open between " -"the parent and child. Providing any *pass_fds* forces *close_fds* to " -"be :const:`True`. (POSIX only)" +"the parent and child. Providing any *pass_fds* forces *close_fds* to be :" +"const:`True`. (POSIX only)" msgstr "" #: ../../library/subprocess.rst:569 @@ -751,10 +747,10 @@ msgstr "新增 *pass_fds* 參數。" #: ../../library/subprocess.rst:572 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " -"*cwd* before executing the child. *cwd* can be a string, bytes " -"or :term:`path-like ` object. On POSIX, the function " -"looks for *executable* (or for the first item in *args*) relative to *cwd* " -"if the executable path is a relative path." +"*cwd* before executing the child. *cwd* can be a string, bytes or :term:" +"`path-like ` object. On POSIX, the function looks for " +"*executable* (or for the first item in *args*) relative to *cwd* if the " +"executable path is a relative path." msgstr "" #: ../../library/subprocess.rst:578 @@ -839,15 +835,15 @@ msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. This mapping can be " -"str to str on any platform or bytes to bytes on POSIX platforms much " -"like :data:`os.environ` or :data:`os.environb`." +"str to str on any platform or bytes to bytes on POSIX platforms much like :" +"data:`os.environ` or :data:`os.environb`." msgstr "" #: ../../library/subprocess.rst:650 msgid "" "If specified, *env* must provide any variables required for the program to " "execute. On Windows, in order to run a `side-by-side assembly`_ the " -"specified *env* **must** include a valid :envvar:`SystemRoot`." +"specified *env* **must** include a valid ``%SystemRoot%``." msgstr "" #: ../../library/subprocess.rst:656 @@ -955,8 +951,8 @@ msgstr "" #: ../../library/subprocess.rst:701 ../../library/subprocess.rst:703 msgid "" -"Popen and the other functions in this module that use it raise " -"an :ref:`auditing event ` ``subprocess.Popen`` with arguments " +"Popen and the other functions in this module that use it raise an :ref:" +"`auditing event ` ``subprocess.Popen`` with arguments " "``executable``, ``args``, ``cwd``, and ``env``. The value for ``args`` may " "be a single string or a list of strings, depending on platform." msgstr "" @@ -976,8 +972,8 @@ msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " "using :func:`os.posix_spawn` no longer raise an exception on errors like " -"missing program, but the child process fails with a non-" -"zero :attr:`~Popen.returncode`." +"missing program, but the child process fails with a non-zero :attr:`~Popen." +"returncode`." msgstr "" #: ../../library/subprocess.rst:724 @@ -994,11 +990,11 @@ msgstr "" msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " -"prepare for :exc:`OSError` exceptions. Note that, when " -"``shell=True``, :exc:`OSError` will be raised by the child only if the " -"selected shell itself was not found. To determine if the shell failed to " -"find the requested application, it is necessary to check the return code or " -"output from the subprocess." +"prepare for :exc:`OSError` exceptions. Note that, when ``shell=True``, :exc:" +"`OSError` will be raised by the child only if the selected shell itself was " +"not found. To determine if the shell failed to find the requested " +"application, it is necessary to check the return code or output from the " +"subprocess." msgstr "" #: ../../library/subprocess.rst:736 @@ -1009,16 +1005,15 @@ msgstr "" #: ../../library/subprocess.rst:739 msgid "" -":func:`check_call` and :func:`check_output` will " -"raise :exc:`CalledProcessError` if the called process returns a non-zero " -"return code." +":func:`check_call` and :func:`check_output` will raise :exc:" +"`CalledProcessError` if the called process returns a non-zero return code." msgstr "" #: ../../library/subprocess.rst:743 msgid "" -"All of the functions and methods that accept a *timeout* parameter, such " -"as :func:`run` and :meth:`Popen.communicate` will " -"raise :exc:`TimeoutExpired` if the timeout expires before the process exits." +"All of the functions and methods that accept a *timeout* parameter, such as :" +"func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if " +"the timeout expires before the process exits." msgstr "" #: ../../library/subprocess.rst:747 @@ -1054,8 +1049,8 @@ msgid "" "this library. This could result in arguments being parsed according to shell " "rules, but without any escaping added by Python. If you are intentionally " "launching a batch file with arguments from untrusted sources, consider " -"passing ``shell=True`` to allow Python to escape special characters. " -"See :gh:`114539` for additional discussion." +"passing ``shell=True`` to allow Python to escape special characters. See :gh:" +"`114539` for additional discussion." msgstr "" #: ../../library/subprocess.rst:777 @@ -1068,21 +1063,21 @@ msgstr "" #: ../../library/subprocess.rst:784 msgid "" -"Check if child process has terminated. Set and " -"return :attr:`~Popen.returncode` attribute. Otherwise, returns ``None``." +"Check if child process has terminated. Set and return :attr:`~Popen." +"returncode` attribute. Otherwise, returns ``None``." msgstr "" #: ../../library/subprocess.rst:790 msgid "" -"Wait for child process to terminate. Set and " -"return :attr:`~Popen.returncode` attribute." +"Wait for child process to terminate. Set and return :attr:`~Popen." +"returncode` attribute." msgstr "" #: ../../library/subprocess.rst:793 msgid "" -"If the process does not terminate after *timeout* seconds, raise " -"a :exc:`TimeoutExpired` exception. It is safe to catch this exception and " -"retry the wait." +"If the process does not terminate after *timeout* seconds, raise a :exc:" +"`TimeoutExpired` exception. It is safe to catch this exception and retry " +"the wait." msgstr "" #: ../../library/subprocess.rst:799 @@ -1097,8 +1092,8 @@ msgstr "" msgid "" "When the ``timeout`` parameter is not ``None``, then (on POSIX) the function " "is implemented using a busy loop (non-blocking call and short sleeps). Use " -"the :mod:`asyncio` module for an asynchronous wait: " -"see :class:`asyncio.create_subprocess_exec`." +"the :mod:`asyncio` module for an asynchronous wait: see :class:`asyncio." +"create_subprocess_exec`." msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 @@ -1133,9 +1128,9 @@ msgstr "" #: ../../library/subprocess.rst:832 msgid "" -"If the process does not terminate after *timeout* seconds, " -"a :exc:`TimeoutExpired` exception will be raised. Catching this exception " -"and retrying communication will not lose any output." +"If the process does not terminate after *timeout* seconds, a :exc:" +"`TimeoutExpired` exception will be raised. Catching this exception and " +"retrying communication will not lose any output." msgstr "" #: ../../library/subprocess.rst:836 @@ -1238,10 +1233,10 @@ msgstr "" #: ../../library/subprocess.rst:922 msgid "" -"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write " -"`, :attr:`.stdout.read ` or :attr:`.stderr.read " -"` to avoid deadlocks due to any of the other OS pipe buffers " -"filling up and blocking the child process." +"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read ` to avoid deadlocks due to any of the other OS pipe buffers filling " +"up and blocking the child process." msgstr "" #: ../../library/subprocess.rst:930 @@ -1298,12 +1293,12 @@ msgstr "" #: ../../library/subprocess.rst:971 msgid "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " -"subprocess.STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" msgstr "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " -"subprocess.STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" #: ../../library/subprocess.rst:976 msgid "" @@ -1337,15 +1332,15 @@ msgstr "" #: ../../library/subprocess.rst:1003 msgid "" -":data:`SW_HIDE` is provided for this attribute. It is used " -"when :class:`Popen` is called with ``shell=True``." +":data:`SW_HIDE` is provided for this attribute. It is used when :class:" +"`Popen` is called with ``shell=True``." msgstr "" #: ../../library/subprocess.rst:1008 msgid "" "A dictionary of additional attributes for process creation as given in " -"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." +"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" #: ../../library/subprocess.rst:1012 @@ -1364,9 +1359,9 @@ msgstr "" #: ../../library/subprocess.rst:1018 msgid "" -"The handles must be temporarily made inheritable " -"by :func:`os.set_handle_inheritable` when passed to the :class:`Popen` " -"constructor, else :class:`OSError` will be raised with Windows error " +"The handles must be temporarily made inheritable by :func:`os." +"set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" +"class:`OSError` will be raised with Windows error " "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" @@ -1374,9 +1369,9 @@ msgstr "" msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " -"other process creation functions that inherit all handles such " -"as :func:`os.system`. This also applies to standard handle redirection, " -"which temporarily creates inheritable handles." +"other process creation functions that inherit all handles such as :func:`os." +"system`. This also applies to standard handle redirection, which " +"temporarily creates inheritable handles." msgstr "" #: ../../library/subprocess.rst:1035 @@ -1411,9 +1406,9 @@ msgstr "" #: ../../library/subprocess.rst:1060 msgid "" -"Specifies that " -"the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO.hStdOutput`, " -"and :attr:`STARTUPINFO.hStdError` attributes contain additional information." +"Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." +"hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " +"information." msgstr "" #: ../../library/subprocess.rst:1066 @@ -1567,11 +1562,10 @@ msgstr "" #: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " -"code was zero then return, otherwise raise :exc:`CalledProcessError`. " -"The :exc:`CalledProcessError` object will have the return code in " -"the :attr:`~CalledProcessError.returncode` attribute. If :func:`check_call` " -"was unable to start the process it will propagate the exception that was " -"raised." +"code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" +"exc:`CalledProcessError` object will have the return code in the :attr:" +"`~CalledProcessError.returncode` attribute. If :func:`check_call` was unable " +"to start the process it will propagate the exception that was raised." msgstr "" #: ../../library/subprocess.rst:1233 @@ -1584,10 +1578,10 @@ msgstr "" #: ../../library/subprocess.rst:1268 msgid "" -"If the return code was non-zero it raises a :exc:`CalledProcessError`. " -"The :exc:`CalledProcessError` object will have the return code in " -"the :attr:`~CalledProcessError.returncode` attribute and any output in " -"the :attr:`~CalledProcessError.output` attribute." +"If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" +"exc:`CalledProcessError` object will have the return code in the :attr:" +"`~CalledProcessError.returncode` attribute and any output in the :attr:" +"`~CalledProcessError.output` attribute." msgstr "" #: ../../library/subprocess.rst:1273 @@ -1602,10 +1596,10 @@ msgstr "run(..., check=True, stdout=PIPE).stdout" msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " -"passed directly through to that interface. One API deviation " -"from :func:`run` behavior exists: passing ``input=None`` will behave the " -"same as ``input=b''`` (or ``input=''``, depending on other arguments) rather " -"than using the parent's standard input file handle." +"passed directly through to that interface. One API deviation from :func:" +"`run` behavior exists: passing ``input=None`` will behave the same as " +"``input=b''`` (or ``input=''``, depending on other arguments) rather than " +"using the parent's standard input file handle." msgstr "" #: ../../library/subprocess.rst:1284 @@ -1624,8 +1618,8 @@ msgstr "" #: ../../library/subprocess.rst:1292 msgid "" -"To also capture standard error in the result, use " -"``stderr=subprocess.STDOUT``::" +"To also capture standard error in the result, use ``stderr=subprocess." +"STDOUT``::" msgstr "" #: ../../library/subprocess.rst:1295 @@ -1663,16 +1657,16 @@ msgstr "" #: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " -"executed program cannot be found; the \"b\" replacements " -"raise :exc:`OSError` instead." +"executed program cannot be found; the \"b\" replacements raise :exc:" +"`OSError` instead." msgstr "" #: ../../library/subprocess.rst:1337 msgid "" -"In addition, the replacements using :func:`check_output` will fail with " -"a :exc:`CalledProcessError` if the requested operation produces a non-zero " -"return code. The output is still available as " -"the :attr:`~CalledProcessError.output` attribute of the raised exception." +"In addition, the replacements using :func:`check_output` will fail with a :" +"exc:`CalledProcessError` if the requested operation produces a non-zero " +"return code. The output is still available as the :attr:`~CalledProcessError." +"output` attribute of the raised exception." msgstr "" #: ../../library/subprocess.rst:1342 @@ -1754,15 +1748,15 @@ msgstr "" #: ../../library/subprocess.rst:1398 msgid "" -"The :func:`call` return value is encoded differently to that " -"of :func:`os.system`." +"The :func:`call` return value is encoded differently to that of :func:`os." +"system`." msgstr "" #: ../../library/subprocess.rst:1401 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " -"command is running, but the caller must do this separately when using " -"the :mod:`subprocess` module." +"command is running, but the caller must do this separately when using the :" +"mod:`subprocess` module." msgstr "" #: ../../library/subprocess.rst:1405 @@ -1774,8 +1768,8 @@ msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, " -"file=sys.stderr)\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1784,8 +1778,8 @@ msgstr "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, " -"file=sys.stderr)\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1903,10 +1897,9 @@ msgstr "" #: ../../library/subprocess.rst:1476 msgid "" -"Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " -"return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " -"decode output; see the notes on :ref:`frequently-used-arguments` for more " -"details." +"Execute the string *cmd* in a shell with :func:`check_output` and return a 2-" +"tuple ``(exitcode, output)``. *encoding* and *errors* are used to decode " +"output; see the notes on :ref:`frequently-used-arguments` for more details." msgstr "" #: ../../library/subprocess.rst:1481 @@ -1942,8 +1935,8 @@ msgstr "新增對 Windows 的支援。" #: ../../library/subprocess.rst:1499 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " -"it did in Python 3.3.3 and earlier. exitcode has the same value " -"as :attr:`~Popen.returncode`." +"it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" +"`~Popen.returncode`." msgstr "" #: ../../library/subprocess.rst:1508 @@ -1978,9 +1971,9 @@ msgstr "" #: ../../library/subprocess.rst:1533 msgid "" -"When using the ``timeout`` parameter in functions " -"like :func:`run`, :meth:`Popen.wait`, or :meth:`Popen.communicate`, users " -"should be aware of the following behaviors:" +"When using the ``timeout`` parameter in functions like :func:`run`, :meth:" +"`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " +"following behaviors:" msgstr "" #: ../../library/subprocess.rst:1537 @@ -2074,9 +2067,9 @@ msgid "" "attribute is available to read. Despite the name, a true value does not " "indicate the corresponding function will be used, only that it may be." msgstr "" -"在任何 Python 版本上將這個設定為 false 都是安全的。當不受支援時,它對舊版本或沒有支援的新版本" -"沒有影響。不要假設屬性可供讀取。儘管它的名稱是這樣,真實值並不表示將使用相應的" -"函式,而只是表示可能會使用。" +"在任何 Python 版本上將這個設定為 false 都是安全的。當不受支援時,它對舊版本或" +"沒有支援的新版本沒有影響。不要假設屬性可供讀取。儘管它的名稱是這樣,真實值並" +"不表示將使用相應的函式,而只是表示可能會使用。" #: ../../library/subprocess.rst:1600 msgid "" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 922eacc438..10c1cdc525 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -342,11 +342,11 @@ msgstr ":monitoring-event:`STOP_ITERATION`" #: ../../library/sys.monitoring.rst:199 msgid "Deprecated event" -msgstr "" +msgstr "已棄用的事件" #: ../../library/sys.monitoring.rst:201 msgid "``BRANCH``" -msgstr "" +msgstr "``BRANCH``" #: ../../library/sys.monitoring.rst:203 msgid "" diff --git a/library/sysconfig.po b/library/sysconfig.po index e529b88de4..01b34730e9 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-29 00:15+0000\n" +"POT-Creation-Date: 2025-10-05 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,10 +109,10 @@ msgstr "" #: ../../library/sysconfig.rst:70 msgid "" "Python uses an installation scheme that differs depending on the platform " -"and on the installation options. These schemes are stored " -"in :mod:`sysconfig` under unique identifiers based on the value returned " -"by :const:`os.name`. The schemes are used by package installers to determine " -"where to copy files to." +"and on the installation options. These schemes are stored in :mod:" +"`sysconfig` under unique identifiers based on the value returned by :const:" +"`os.name`. The schemes are used by package installers to determine where to " +"copy files to." msgstr "" #: ../../library/sysconfig.rst:75 @@ -134,8 +134,8 @@ msgstr "" #: ../../library/sysconfig.rst:81 msgid "" "*posix_user*: scheme for POSIX platforms, when the *user* option is used. " -"This scheme defines paths located under the user's home directory " -"(:const:`site.USER_BASE`)." +"This scheme defines paths located under the user's home directory (:const:" +"`site.USER_BASE`)." msgstr "" #: ../../library/sysconfig.rst:84 @@ -233,8 +233,8 @@ msgstr "" msgid "" "Files will be installed into subdirectories of :const:`site.USER_BASE` " "(written as :file:`{userbase}` hereafter). This scheme installs pure Python " -"modules and extension modules in the same location (also known " -"as :const:`site.USER_SITE`)." +"modules and extension modules in the same location (also known as :const:" +"`site.USER_SITE`)." msgstr "" #: ../../library/sysconfig.rst:126 @@ -357,8 +357,8 @@ msgid "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` " -"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` or :file:" +"`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" @@ -479,8 +479,8 @@ msgstr "" #: ../../library/sysconfig.rst:265 msgid "" -"Return a tuple containing all schemes currently supported " -"in :mod:`sysconfig`." +"Return a tuple containing all schemes currently supported in :mod:" +"`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:271 @@ -532,14 +532,14 @@ msgstr "" #: ../../library/sysconfig.rst:307 msgid "" -"End users should not use this function, but :func:`get_default_scheme` " -"and :func:`get_preferred_scheme` instead." +"End users should not use this function, but :func:`get_default_scheme` and :" +"func:`get_preferred_scheme` instead." msgstr "" #: ../../library/sysconfig.rst:315 msgid "" -"Return a tuple containing all path names currently supported " -"in :mod:`sysconfig`." +"Return a tuple containing all path names currently supported in :mod:" +"`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:321 @@ -569,9 +569,9 @@ msgstr "" #: ../../library/sysconfig.rst:334 msgid "" -"If *scheme* is provided, it must be a value from the list returned " -"by :func:`get_scheme_names`. Otherwise, the default scheme for the current " -"platform is used." +"If *scheme* is provided, it must be a value from the list returned by :func:" +"`get_scheme_names`. Otherwise, the default scheme for the current platform " +"is used." msgstr "" #: ../../library/sysconfig.rst:338 @@ -614,8 +614,8 @@ msgstr "" #: ../../library/sysconfig.rst:360 msgid "" -"If *scheme* is not an existing scheme, :func:`get_paths` will raise " -"a :exc:`KeyError`." +"If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" +"`KeyError`." msgstr "" #: ../../library/sysconfig.rst:365 @@ -627,8 +627,8 @@ msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % " -"sys.version_info[:2]``。" +"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % sys." +"version_info[:2]``。" #: ../../library/sysconfig.rst:375 msgid "Return a string that identifies the current platform." @@ -647,99 +647,87 @@ msgstr "" msgid "Examples of returned values:" msgstr "" -#: ../../library/sysconfig.rst:385 -msgid "linux-i586" -msgstr "linux-i586" - #: ../../library/sysconfig.rst:386 -msgid "linux-alpha (?)" -msgstr "linux-alpha (?)" +msgid "Windows:" +msgstr "Windows:" -#: ../../library/sysconfig.rst:387 -msgid "solaris-2.6-sun4u" -msgstr "solaris-2.6-sun4u" +#: ../../library/sysconfig.rst:388 +msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +msgstr "" #: ../../library/sysconfig.rst:389 -msgid "Windows will return one of:" +msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" msgstr "" -#: ../../library/sysconfig.rst:391 -msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +#: ../../library/sysconfig.rst:390 +msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" #: ../../library/sysconfig.rst:392 -msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" +msgid "POSIX based OS:" msgstr "" -#: ../../library/sysconfig.rst:393 -msgid "win32 (all others - specifically, sys.platform is returned)" -msgstr "" +#: ../../library/sysconfig.rst:394 +msgid "linux-x86_64" +msgstr "linux-x86_64" #: ../../library/sysconfig.rst:395 -msgid "macOS can return:" +msgid "macosx-15.5-arm64" +msgstr "macosx-15.5-arm64" + +#: ../../library/sysconfig.rst:396 +msgid "macosx-26.0-universal2 (macOS on Apple Silicon or Intel)" msgstr "" #: ../../library/sysconfig.rst:397 -msgid "macosx-10.6-ppc" -msgstr "macosx-10.6-ppc" - -#: ../../library/sysconfig.rst:398 -msgid "macosx-10.4-ppc64" -msgstr "macosx-10.4-ppc64" +msgid "android-24-arm64_v8a" +msgstr "android-24-arm64_v8a" #: ../../library/sysconfig.rst:399 -msgid "macosx-10.3-i386" -msgstr "macosx-10.3-i386" - -#: ../../library/sysconfig.rst:400 -msgid "macosx-10.4-fat" -msgstr "macosx-10.4-fat" - -#: ../../library/sysconfig.rst:402 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:407 +#: ../../library/sysconfig.rst:404 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: ../../library/sysconfig.rst:414 +#: ../../library/sysconfig.rst:411 msgid "Parse a :file:`config.h`\\-style file." -msgstr "" +msgstr "剖析一個 :file:`config.h` 風格的檔案。" -#: ../../library/sysconfig.rst:416 +#: ../../library/sysconfig.rst:413 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:418 +#: ../../library/sysconfig.rst:415 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: ../../library/sysconfig.rst:425 +#: ../../library/sysconfig.rst:422 msgid "Return the path of :file:`pyconfig.h`." msgstr "回傳 :file:`pyconfig.h` 的路徑。" -#: ../../library/sysconfig.rst:429 +#: ../../library/sysconfig.rst:426 msgid "Return the path of :file:`Makefile`." msgstr "回傳 :file:`Makefile` 的路徑。" -#: ../../library/sysconfig.rst:435 +#: ../../library/sysconfig.rst:432 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/sysconfig.rst:437 +#: ../../library/sysconfig.rst:434 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:439 +#: ../../library/sysconfig.rst:436 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -785,16 +773,31 @@ msgstr "" " ARFLAGS = \"rc\"\n" " ..." -#: ../../library/sysconfig.rst:463 +#: ../../library/sysconfig.rst:460 msgid "" -"This call will print in the standard output the information returned " -"by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " -"and :func:`get_config_vars`." +"This call will print in the standard output the information returned by :" +"func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" +"`get_config_vars`." msgstr "" #: ../../library/sysconfig.rst:14 msgid "configuration information" msgstr "configuration information(設定資訊)" +#~ msgid "linux-alpha (?)" +#~ msgstr "linux-alpha (?)" + +#~ msgid "solaris-2.6-sun4u" +#~ msgstr "solaris-2.6-sun4u" + +#~ msgid "macosx-10.6-ppc" +#~ msgstr "macosx-10.6-ppc" + +#~ msgid "macosx-10.3-i386" +#~ msgstr "macosx-10.3-i386" + +#~ msgid "macosx-10.4-fat" +#~ msgstr "macosx-10.4-fat" + #~ msgid "Using :mod:`sysconfig` as a script" #~ msgstr "將 :mod:`sysconfig` 作為腳本使用" diff --git a/library/textwrap.po b/library/textwrap.po index 7d04efaac3..a6055637cb 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -90,6 +90,12 @@ msgid "" ">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" "'Hello...'" msgstr "" +">>> textwrap.shorten(\"Hello world!\", width=12)\n" +"'Hello world!'\n" +">>> textwrap.shorten(\"Hello world!\", width=11)\n" +"'Hello [...]'\n" +">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" +"'Hello...'" #: ../../library/textwrap.rst:72 msgid "" diff --git a/library/time.po b/library/time.po index ae1603fb31..8c011ec6a9 100644 --- a/library/time.po +++ b/library/time.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-10-15 00:16+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-" @@ -384,11 +384,11 @@ msgstr "其結果具有以下屬性:" #: ../../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" +"*adjustable*: ``True`` if the clock can be set to jump forward or backward " +"in time, ``False`` otherwise. Does not refer to gradual NTP rate adjustments." msgstr "" -"*adjustable*: 如果時鐘可以自動(例如,透過 NTP 常駐程式)或由系統管理員手動更" -"改,則為 ``True``,否則為 ``False``" +"*adjustable*: 如果時鐘可以設定為向前或向後跳轉時間則為 ``True``,否則為 ``False``。" +"不指漸進式的 NTP 速率調整。" #: ../../library/time.rst:243 msgid "" @@ -647,7 +647,7 @@ msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" #: ../../library/time.rst:412 msgid "" "To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." -msgstr "" +msgstr "要模擬「無動作 (no-op)」,請使用 :keyword:`pass` 而不是 ``time.sleep(0)``。" #: ../../library/time.rst:414 msgid "" @@ -1601,8 +1601,8 @@ msgid "" "`International Atomic Time `_" msgstr "" -"`國際原子時間 `_" +"`國際原子時間 `_" #: ../../library/time.rst:940 msgid "" diff --git a/library/tkinter.po b/library/tkinter.po index 70c31480ca..974a2ab0e1 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-10-20 00:15+0000\n" "PO-Revision-Date: 2025-07-13 20:00+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -218,7 +218,7 @@ msgstr "" "繞著協同多工(cooperative multitasking)設計的,而 Tkinter 則彌合了這種差異" "(詳情請參閱 `Threading model`_)。" -#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 +#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:906 msgid "Tk" msgstr "Tk" @@ -844,8 +844,8 @@ msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" -"在 Tcl 中,元件是透過\\ *路徑名稱*\\ (如 ``.frm.btn``)來參照,而 Tkinter 不使" -"用名稱,而是使用物件參照。" +"在 Tcl 中,元件是透過\\ *路徑名稱*\\ (如 ``.frm.btn``)來參照,而 Tkinter 不" +"使用名稱,而是使用物件參照。" #: ../../library/tkinter.rst:386 msgid "" @@ -863,8 +863,8 @@ msgid "" "Operations which are implemented as separate *commands* in Tcl (like " "``grid`` or ``destroy``) are represented as *methods* on Tkinter widget " "objects. As you'll see shortly, at other times Tcl uses what appear to be " -"method calls on widget objects, which more closely mirror what would is used " -"in Tkinter." +"method calls on widget objects, which more closely mirror what is used in " +"Tkinter." msgstr "" "在 Tcl 中實作為獨立\\ *指令*\\ 的操作(如 ``grid`` 或 ``destroy``),在 " "Tkinter 中則表示為元件物件上的\\ *方法*。正如你稍後會看到的,在其他時候,Tcl " @@ -1530,7 +1530,7 @@ msgstr "" "叫 :meth:`get` 方法,要更改其值,則呼叫 :meth:`!set` 方法。如果你遵循此協定," "元件將始終追蹤變數的值,無需你進一步干預。" -#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 +#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:893 msgid "For example::" msgstr "舉例來說: ::" @@ -1809,16 +1809,16 @@ msgstr "justify" #: ../../library/tkinter.rst:842 msgid "" -"Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " -"and ``\"fill\"``." +"Legal values are the strings: ``\"left\"``, ``\"center\"``, and " +"``\"right\"``." msgstr "" -"合法值為字串:``\"left\"``、``\"center\"``、``\"right\"`` 和 ``\"fill\"``。" +"合法值為字串:``\"left\"``、``\"center\"`` 和 ``\"right\"``。" -#: ../../library/tkinter.rst:845 +#: ../../library/tkinter.rst:844 msgid "region" msgstr "region" -#: ../../library/tkinter.rst:846 +#: ../../library/tkinter.rst:845 msgid "" "This is a string with four space-delimited elements, each of which is a " "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " @@ -1828,11 +1828,11 @@ msgstr "" "文)。例如:``\"2 3 4 5\"``、``\"3i 2i 4.5i 2i\"`` 和 ``\"3c 2c 4c " "10.43c\"`` 都是合法的區域。" -#: ../../library/tkinter.rst:850 +#: ../../library/tkinter.rst:849 msgid "relief" msgstr "relief" -#: ../../library/tkinter.rst:851 +#: ../../library/tkinter.rst:850 msgid "" "Determines what the border style of a widget will be. Legal values are: " "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " @@ -1841,11 +1841,11 @@ msgstr "" "決定元件的邊框樣式。合法值為:``\"raised\"``、``\"sunken\"``、``\"flat\"``、" "``\"groove\"`` 和 ``\"ridge\"``。" -#: ../../library/tkinter.rst:854 +#: ../../library/tkinter.rst:853 msgid "scrollcommand" msgstr "scrollcommand" -#: ../../library/tkinter.rst:855 +#: ../../library/tkinter.rst:854 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." @@ -1853,19 +1853,19 @@ msgstr "" "這幾乎總是某個捲軸元件的 :meth:`!set` 方法,但也可以是任何接受單一引數的元件" "方法。" -#: ../../library/tkinter.rst:858 +#: ../../library/tkinter.rst:857 msgid "wrap" msgstr "wrap" -#: ../../library/tkinter.rst:859 +#: ../../library/tkinter.rst:858 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." msgstr "必須是以下之一:``\"none\"``、``\"char\"`` 或 ``\"word\"``。" -#: ../../library/tkinter.rst:864 +#: ../../library/tkinter.rst:863 msgid "Bindings and Events" msgstr "繫結與事件" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:869 msgid "" "The bind method from the widget command allows you to watch for certain " "events and to have a callback function trigger when that event type occurs. " @@ -1874,19 +1874,19 @@ msgstr "" "來自元件指令的 bind 方法允許你監視某些事件,並在該事件類型發生時觸發一個回呼" "函式。bind 方法的形式是: ::" -#: ../../library/tkinter.rst:874 +#: ../../library/tkinter.rst:873 msgid "def bind(self, sequence, func, add=''):" msgstr "def bind(self, sequence, func, add=''):" -#: ../../library/tkinter.rst:876 +#: ../../library/tkinter.rst:875 msgid "where:" msgstr "其中:" -#: ../../library/tkinter.rst:878 +#: ../../library/tkinter.rst:877 msgid "sequence" msgstr "sequence" -#: ../../library/tkinter.rst:879 +#: ../../library/tkinter.rst:878 msgid "" "is a string that denotes the target kind of event. (See the :manpage:" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" @@ -1896,11 +1896,11 @@ msgstr "" "及 John Ousterhout 的書 :title-reference:`Tcl and the Tk Toolkit (2nd " "edition)` 的第 201 頁)。" -#: ../../library/tkinter.rst:883 +#: ../../library/tkinter.rst:882 msgid "func" msgstr "func" -#: ../../library/tkinter.rst:884 +#: ../../library/tkinter.rst:883 msgid "" "is a Python function, taking one argument, to be invoked when the event " "occurs. An Event instance will be passed as the argument. (Functions " @@ -1909,11 +1909,11 @@ msgstr "" "是一個 Python 函式,接受一個引數,在事件發生時被呼叫。一個 Event 實例將作為引" "數傳遞。(以這種方式部署的函式通常稱為\\ *回呼*。)" -#: ../../library/tkinter.rst:888 +#: ../../library/tkinter.rst:887 msgid "add" msgstr "add" -#: ../../library/tkinter.rst:889 +#: ../../library/tkinter.rst:888 msgid "" "is optional, either ``''`` or ``'+'``. Passing an empty string denotes that " "this binding is to replace any other bindings that this event is associated " @@ -1924,7 +1924,7 @@ msgstr "" "聯的任何其他繫結。傳遞一個 ``'+'`` 意味著此函式將被新增到繫結到此事件類型的函" "式串列中。" -#: ../../library/tkinter.rst:896 +#: ../../library/tkinter.rst:895 msgid "" "def turn_red(self, event):\n" " event.widget[\"activeforeground\"] = \"red\"\n" @@ -1936,7 +1936,7 @@ msgstr "" "\n" "self.button.bind(\"\", self.turn_red)" -#: ../../library/tkinter.rst:901 +#: ../../library/tkinter.rst:900 msgid "" "Notice how the widget field of the event is being accessed in the " "``turn_red()`` callback. This field contains the widget that caught the X " @@ -1948,143 +1948,143 @@ msgstr "" "件的元件。下表列出了你可以存取的其他事件欄位,以及它們在 Tk 中的表示方式,這" "在參閱 Tk man pages 時可能很有用。" -#: ../../library/tkinter.rst:907 +#: ../../library/tkinter.rst:906 msgid "Tkinter Event Field" msgstr "Tkinter 事件欄位" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "%f" msgstr "%f" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "focus" msgstr "focus" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "%A" msgstr "%A" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "char" msgstr "char" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "height" msgstr "height" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "%E" msgstr "%E" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "send_event" msgstr "send_event" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "%k" msgstr "%k" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "keycode" msgstr "keycode" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "%K" msgstr "%K" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "keysym" msgstr "keysym" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "%s" msgstr "%s" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "state" msgstr "state" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "%N" msgstr "%N" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "keysym_num" msgstr "keysym_num" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "%t" msgstr "%t" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "time" msgstr "time" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "%T" msgstr "%T" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "type" msgstr "type" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "width" msgstr "width" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "%W" msgstr "%W" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "widget" msgstr "widget" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "%x" msgstr "%x" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "x" msgstr "x" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "%X" msgstr "%X" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "x_root" msgstr "x_root" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "%y" msgstr "%y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "y" msgstr "y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "%Y" msgstr "%Y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "y_root" msgstr "y_root" -#: ../../library/tkinter.rst:928 +#: ../../library/tkinter.rst:927 msgid "The index Parameter" msgstr "index 參數" -#: ../../library/tkinter.rst:930 +#: ../../library/tkinter.rst:929 msgid "" "A number of widgets require \"index\" parameters to be passed. These are " "used to point at a specific place in a Text widget, or to particular " @@ -2093,11 +2093,11 @@ msgstr "" "許多元件需要傳遞 \"index\" 參數。這些參數用於指向 Text 元件中的特定位置、" "Entry 元件中的特定字元,或 Menu 元件中的特定選單項目。" -#: ../../library/tkinter.rst:934 +#: ../../library/tkinter.rst:933 msgid "Entry widget indexes (index, view index, etc.)" msgstr "Entry 元件索引(index、view index 等)" -#: ../../library/tkinter.rst:935 +#: ../../library/tkinter.rst:934 msgid "" "Entry widgets have options that refer to character positions in the text " "being displayed. You can use these :mod:`tkinter` functions to access these " @@ -2106,21 +2106,21 @@ msgstr "" "Entry 元件具有參照所顯示文字中字元位置的選項。你可以使用這些 :mod:`tkinter` " "函式來存取文字元件中的這些特殊點:" -#: ../../library/tkinter.rst:939 +#: ../../library/tkinter.rst:938 msgid "Text widget indexes" msgstr "Text 元件索引" -#: ../../library/tkinter.rst:940 +#: ../../library/tkinter.rst:939 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." msgstr "Text 元件的索引表示法非常豐富,在 Tk man pages 中有最好的描述。" -#: ../../library/tkinter.rst:943 +#: ../../library/tkinter.rst:942 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" msgstr "選單索引(menu.invoke()、menu.entryconfig() 等)" -#: ../../library/tkinter.rst:944 +#: ../../library/tkinter.rst:943 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" @@ -2128,23 +2128,23 @@ msgstr "" "選單的某些選項和方法會操作特定的選單項目。每當選項或參數需要選單索引時,你可" "以傳入:" -#: ../../library/tkinter.rst:947 +#: ../../library/tkinter.rst:946 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" msgstr "一個整數,它參照元件中項目的數字位置,從頂部開始計數,從 0 開始;" -#: ../../library/tkinter.rst:950 +#: ../../library/tkinter.rst:949 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" msgstr "字串 ``\"active\"``,它參照目前在游標下的選單位置;" -#: ../../library/tkinter.rst:953 +#: ../../library/tkinter.rst:952 msgid "the string ``\"last\"`` which refers to the last menu item;" msgstr "字串 ``\"last\"``,它參照最後一個選單項目;" -#: ../../library/tkinter.rst:955 +#: ../../library/tkinter.rst:954 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" @@ -2152,7 +2152,7 @@ msgstr "" "一個以 ``@`` 為前綴的整數,如 ``@6``,其中該整數被解釋為選單座標系統中的 y 像" "素座標;" -#: ../../library/tkinter.rst:958 +#: ../../library/tkinter.rst:957 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," @@ -2160,7 +2160,7 @@ msgstr "" "字串 ``\"none\"``,表示完全沒有選單項目,最常用於 menu.activate() 以停用所有" "項目,最後," -#: ../../library/tkinter.rst:961 +#: ../../library/tkinter.rst:960 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -2172,21 +2172,21 @@ msgstr "" "此索引類型在所有其他類型之後考慮,這意味著標籤為 ``last``、``active`` 或 " "``none`` 的選單項目的匹配可能會被解釋為上述的字面值。" -#: ../../library/tkinter.rst:969 +#: ../../library/tkinter.rst:968 msgid "Images" msgstr "圖片" -#: ../../library/tkinter.rst:971 +#: ../../library/tkinter.rst:970 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" msgstr "可以透過 :class:`tkinter.Image` 的相應子類別來建立不同格式的圖片:" -#: ../../library/tkinter.rst:974 +#: ../../library/tkinter.rst:973 msgid ":class:`BitmapImage` for images in XBM format." msgstr ":class:`BitmapImage` 用於 XBM 格式的圖片。" -#: ../../library/tkinter.rst:976 +#: ../../library/tkinter.rst:975 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." @@ -2194,14 +2194,14 @@ msgstr "" ":class:`PhotoImage` 用於 PGM、PPM、GIF 和 PNG 格式的圖片。後者從 Tk 8.6 開始" "支援。" -#: ../../library/tkinter.rst:979 +#: ../../library/tkinter.rst:978 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" "任一類型的圖片都是透過 ``file`` 或 ``data`` 選項建立的(也有其他選項可用)。" -#: ../../library/tkinter.rst:982 +#: ../../library/tkinter.rst:981 msgid "" "Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " "from one image to other image, possibly with pixel zooming and/or " @@ -2215,7 +2215,7 @@ msgstr "" "subsample`。將 *zoom* 和 *subsample* 參數新增到 :class:`!PhotoImage` 方法 :" "meth:`!copy`。" -#: ../../library/tkinter.rst:991 +#: ../../library/tkinter.rst:990 msgid "" "The image object can then be used wherever an ``image`` option is supported " "by some widget (e.g. labels, buttons, menus). In these cases, Tk will not " @@ -2227,7 +2227,7 @@ msgstr "" "用。在這些情況下,Tk 將不會保留對圖片的參照。當對圖片物件的最後一個 Python 參" "照被刪除時,圖片資料也會被刪除,Tk 將在使用該圖片的任何地方顯示一個空框。" -#: ../../library/tkinter.rst:999 +#: ../../library/tkinter.rst:998 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." @@ -2235,11 +2235,11 @@ msgstr "" "`Pillow `_ 套件新增了對 BMP、JPEG、TIFF 和 WebP " "等格式的支援。" -#: ../../library/tkinter.rst:1005 +#: ../../library/tkinter.rst:1004 msgid "File Handlers" msgstr "檔案處理常式" -#: ../../library/tkinter.rst:1007 +#: ../../library/tkinter.rst:1006 msgid "" "Tk allows you to register and unregister a callback function which will be " "called from the Tk mainloop when I/O is possible on a file descriptor. Only " @@ -2248,7 +2248,7 @@ msgstr "" "Tk 允許你註冊和取消註冊一個回呼函式,當檔案描述器上可以進行 I/O 時,該函式將" "從 Tk 主迴圈中被呼叫。每個檔案描述器只能註冊一個處理常式。範例程式碼: ::" -#: ../../library/tkinter.rst:1011 +#: ../../library/tkinter.rst:1010 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -2264,11 +2264,11 @@ msgstr "" "...\n" "widget.tk.deletefilehandler(file)" -#: ../../library/tkinter.rst:1018 +#: ../../library/tkinter.rst:1017 msgid "This feature is not available on Windows." msgstr "此功能在 Windows 上不可用。" -#: ../../library/tkinter.rst:1020 +#: ../../library/tkinter.rst:1019 msgid "" "Since you don't know how many bytes are available for reading, you may not " "want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" @@ -2285,7 +2285,7 @@ msgstr "" "法可以正常運作;對於其他檔案,請使用原始讀取或 ``os.read(file.fileno(), " "maxbytecount)``。" -#: ../../library/tkinter.rst:1031 +#: ../../library/tkinter.rst:1030 msgid "" "Registers the file handler callback function *func*. The *file* argument may " "either be an object with a :meth:`~io.IOBase.fileno` method (such as a file " @@ -2298,15 +2298,15 @@ msgstr "" "器。*mask* 引數是下面三個常數中任意一個的 OR 組合。回呼函式被呼叫的方式如" "下: ::" -#: ../../library/tkinter.rst:1037 +#: ../../library/tkinter.rst:1036 msgid "callback(file, mask)" msgstr "callback(file, mask)" -#: ../../library/tkinter.rst:1042 +#: ../../library/tkinter.rst:1041 msgid "Unregisters a file handler." msgstr "取消註冊檔案處理常式。" -#: ../../library/tkinter.rst:1049 +#: ../../library/tkinter.rst:1048 msgid "Constants used in the *mask* arguments." msgstr "用於 *mask* 引數的常數。" @@ -2318,11 +2318,11 @@ msgstr "packing(元件)" msgid "window manager (widgets)" msgstr "視窗管理器(元件)" -#: ../../library/tkinter.rst:866 +#: ../../library/tkinter.rst:865 msgid "bind (widgets)" msgstr "bind(元件)" -#: ../../library/tkinter.rst:866 +#: ../../library/tkinter.rst:865 msgid "events (widgets)" msgstr "事件(元件)" diff --git a/library/tokenize.po b/library/tokenize.po index 90da94efa3..19da1be9e4 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -227,7 +227,7 @@ msgstr "" #: ../../library/tokenize.rst:153 msgid "Command-Line Usage" -msgstr "" +msgstr "命令列用法" #: ../../library/tokenize.rst:157 msgid "" diff --git a/library/traceback.po b/library/traceback.po index f8ae57c03b..82709ec956 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -835,6 +835,14 @@ msgid "" ">>> traceback.format_exception_only(an_error)\n" "['IndexError: tuple index out of range\\n']" msgstr "" +">>> import traceback\n" +">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" +"... ('eggs.py', 42, 'eggs', 'return \"bacon\"')])\n" +"[' File \"spam.py\", line 3, in \\n spam.eggs()\\n',\n" +" ' File \"eggs.py\", line 42, in eggs\\n return \"bacon\"\\n']\n" +">>> an_error = IndexError('tuple index out of range')\n" +">>> traceback.format_exception_only(an_error)\n" +"['IndexError: tuple index out of range\\n']" #: ../../library/traceback.rst:718 msgid "Examples of Using :class:`TracebackException`" diff --git a/library/turtle.po b/library/turtle.po index b134109998..167466940b 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 00:14+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-" @@ -37,8 +37,8 @@ msgid "" "developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967." msgstr "" "龜圖學是由 Wally Feurzeig,Seymour Papert 與 Cynthia Solomon 於 1967 年開發" -"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" +"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" #: ../../library/turtle.rst:34 msgid "Get started" @@ -157,7 +157,7 @@ msgid "" msgstr "" #: ../../library/turtle.rst:110 ../../library/turtle.rst:364 -#: ../../library/turtle.rst:1058 +#: ../../library/turtle.rst:1062 msgid "Pen control" msgstr "" @@ -322,8 +322,8 @@ msgstr "" #: ../../library/turtle.rst:200 msgid "" "The turtle module makes this possible by exposing all its basic " -"functionality as functions, available with ``from turtle import *``. " -"The :ref:`turtle graphics tutorial ` covers this approach." +"functionality as functions, available with ``from turtle import *``. The :" +"ref:`turtle graphics tutorial ` covers this approach." msgstr "" #: ../../library/turtle.rst:204 @@ -579,7 +579,7 @@ msgstr ":func:`setheading` | :func:`seth`" msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2862 msgid ":func:`circle`" msgstr ":func:`circle`" @@ -587,7 +587,7 @@ msgstr ":func:`circle`" msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2840 msgid ":func:`stamp`" msgstr ":func:`stamp`" @@ -607,7 +607,7 @@ msgstr ":func:`undo`" msgid ":func:`speed`" msgstr ":func:`speed`" -#: ../../library/turtle.rst:352 ../../library/turtle.rst:907 +#: ../../library/turtle.rst:352 ../../library/turtle.rst:911 msgid "Tell Turtle's state" msgstr "" @@ -647,7 +647,7 @@ msgstr ":func:`degrees`" msgid ":func:`radians`" msgstr ":func:`radians`" -#: ../../library/turtle.rst:365 ../../library/turtle.rst:1061 +#: ../../library/turtle.rst:365 ../../library/turtle.rst:1065 msgid "Drawing state" msgstr "" @@ -671,7 +671,7 @@ msgstr ":func:`pen`" msgid ":func:`isdown`" msgstr ":func:`isdown`" -#: ../../library/turtle.rst:372 ../../library/turtle.rst:1153 +#: ../../library/turtle.rst:372 ../../library/turtle.rst:1157 msgid "Color control" msgstr "" @@ -687,7 +687,7 @@ msgstr ":func:`pencolor`" msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" -#: ../../library/turtle.rst:377 ../../library/turtle.rst:1285 +#: ../../library/turtle.rst:377 ../../library/turtle.rst:1296 msgid "Filling" msgstr "" @@ -707,7 +707,7 @@ msgstr ":func:`begin_fill`" msgid ":func:`end_fill`" msgstr ":func:`end_fill`" -#: ../../library/turtle.rst:383 ../../library/turtle.rst:1355 +#: ../../library/turtle.rst:383 ../../library/turtle.rst:1366 msgid "More drawing control" msgstr "" @@ -723,11 +723,11 @@ msgstr ":func:`clear`" msgid ":func:`write`" msgstr ":func:`write`" -#: ../../library/turtle.rst:388 ../../library/turtle.rst:1401 +#: ../../library/turtle.rst:388 ../../library/turtle.rst:1412 msgid "Turtle state" msgstr "" -#: ../../library/turtle.rst:389 ../../library/turtle.rst:1404 +#: ../../library/turtle.rst:389 ../../library/turtle.rst:1415 msgid "Visibility" msgstr "" @@ -743,7 +743,7 @@ msgstr ":func:`hideturtle` | :func:`ht`" msgid ":func:`isvisible`" msgstr ":func:`isvisible`" -#: ../../library/turtle.rst:394 ../../library/turtle.rst:1443 +#: ../../library/turtle.rst:394 ../../library/turtle.rst:1454 msgid "Appearance" msgstr "" @@ -779,11 +779,11 @@ msgstr ":func:`shapetransform`" msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" -#: ../../library/turtle.rst:404 ../../library/turtle.rst:1626 +#: ../../library/turtle.rst:404 ../../library/turtle.rst:1637 msgid "Using events" msgstr "" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2834 msgid ":func:`onclick`" msgstr ":func:`onclick`" @@ -791,11 +791,11 @@ msgstr ":func:`onclick`" msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2817 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" -#: ../../library/turtle.rst:409 ../../library/turtle.rst:1700 +#: ../../library/turtle.rst:409 ../../library/turtle.rst:1711 msgid "Special Turtle methods" msgstr "" @@ -815,7 +815,7 @@ msgstr ":func:`end_poly`" msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2856 msgid ":func:`clone`" msgstr ":func:`clone`" @@ -839,7 +839,7 @@ msgstr ":func:`undobufferentries`" msgid "Methods of TurtleScreen/Screen" msgstr "" -#: ../../library/turtle.rst:424 ../../library/turtle.rst:1871 +#: ../../library/turtle.rst:424 ../../library/turtle.rst:1882 msgid "Window control" msgstr "" @@ -867,7 +867,7 @@ msgstr ":func:`screensize`" msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" -#: ../../library/turtle.rst:432 ../../library/turtle.rst:1995 +#: ../../library/turtle.rst:432 ../../library/turtle.rst:2025 msgid "Animation control" msgstr "" @@ -887,7 +887,7 @@ msgstr ":func:`tracer`" msgid ":func:`update`" msgstr ":func:`update`" -#: ../../library/turtle.rst:438 ../../library/turtle.rst:2065 +#: ../../library/turtle.rst:438 ../../library/turtle.rst:2095 msgid "Using screen events" msgstr "" @@ -915,7 +915,7 @@ msgstr ":func:`ontimer`" msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" -#: ../../library/turtle.rst:446 ../../library/turtle.rst:2210 +#: ../../library/turtle.rst:446 ../../library/turtle.rst:2240 msgid "Settings and special methods" msgstr "" @@ -951,7 +951,7 @@ msgstr ":func:`window_height`" msgid ":func:`window_width`" msgstr ":func:`window_width`" -#: ../../library/turtle.rst:456 ../../library/turtle.rst:2174 +#: ../../library/turtle.rst:456 ../../library/turtle.rst:2204 msgid "Input methods" msgstr "" @@ -1034,7 +1034,7 @@ msgstr "" "(-50.00,0.00)" #: ../../library/turtle.rst:502 ../../library/turtle.rst:744 -#: ../../library/turtle.rst:1011 ../../library/turtle.rst:1542 +#: ../../library/turtle.rst:1015 ../../library/turtle.rst:1553 msgid "a number" msgstr "" @@ -1111,8 +1111,8 @@ msgstr "" #: ../../library/turtle.rst:579 msgid "" -"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " -"(e.g. as returned by :func:`pos`)." +"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." +"g. as returned by :func:`pos`)." msgstr "" #: ../../library/turtle.rst:582 @@ -1317,7 +1317,7 @@ msgstr "" msgid "a number (or ``None``)" msgstr "" -#: ../../library/turtle.rst:746 ../../library/turtle.rst:839 +#: ../../library/turtle.rst:746 ../../library/turtle.rst:843 msgid "an integer (or ``None``)" msgstr "" @@ -1358,21 +1358,21 @@ msgid "" "180.0" msgstr "" -#: ../../library/turtle.rst:782 +#: ../../library/turtle.rst:786 msgid "an integer >= 1 (if given)" msgstr "" -#: ../../library/turtle.rst:783 +#: ../../library/turtle.rst:787 msgid "a colorstring or a numeric color tuple" msgstr "" -#: ../../library/turtle.rst:785 +#: ../../library/turtle.rst:789 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " -"given, the maximum of pensize+4 and 2*pensize is used." +"given, the maximum of ``pensize+4`` and ``2*pensize`` is used." msgstr "" -#: ../../library/turtle.rst:789 +#: ../../library/turtle.rst:793 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1390,14 +1390,14 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:803 +#: ../../library/turtle.rst:807 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: ../../library/turtle.rst:807 +#: ../../library/turtle.rst:811 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" @@ -1407,15 +1407,15 @@ msgstr "" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:817 +#: ../../library/turtle.rst:821 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: ../../library/turtle.rst:820 +#: ../../library/turtle.rst:824 msgid "Delete stamp with given *stampid*." msgstr "" -#: ../../library/turtle.rst:822 +#: ../../library/turtle.rst:826 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1439,14 +1439,14 @@ msgstr "" ">>> turtle.position()\n" "(200.00,-0.00)" -#: ../../library/turtle.rst:841 +#: ../../library/turtle.rst:845 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: ../../library/turtle.rst:845 +#: ../../library/turtle.rst:849 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1462,13 +1462,13 @@ msgstr "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" -#: ../../library/turtle.rst:857 +#: ../../library/turtle.rst:861 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: ../../library/turtle.rst:860 +#: ../../library/turtle.rst:864 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1482,55 +1482,55 @@ msgstr "" ">>> for i in range(8):\n" "... turtle.undo()" -#: ../../library/turtle.rst:872 +#: ../../library/turtle.rst:876 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: ../../library/turtle.rst:874 +#: ../../library/turtle.rst:878 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: ../../library/turtle.rst:877 +#: ../../library/turtle.rst:881 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: ../../library/turtle.rst:880 +#: ../../library/turtle.rst:884 msgid "\"fastest\": 0" msgstr "" -#: ../../library/turtle.rst:881 +#: ../../library/turtle.rst:885 msgid "\"fast\": 10" msgstr "" -#: ../../library/turtle.rst:882 +#: ../../library/turtle.rst:886 msgid "\"normal\": 6" msgstr "" -#: ../../library/turtle.rst:883 +#: ../../library/turtle.rst:887 msgid "\"slow\": 3" msgstr "" -#: ../../library/turtle.rst:884 +#: ../../library/turtle.rst:888 msgid "\"slowest\": 1" msgstr "" -#: ../../library/turtle.rst:886 +#: ../../library/turtle.rst:890 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: ../../library/turtle.rst:889 +#: ../../library/turtle.rst:893 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: ../../library/turtle.rst:893 +#: ../../library/turtle.rst:897 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1550,12 +1550,12 @@ msgstr "" ">>> turtle.speed()\n" "9" -#: ../../library/turtle.rst:912 +#: ../../library/turtle.rst:916 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: ../../library/turtle.rst:914 +#: ../../library/turtle.rst:918 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" @@ -1563,15 +1563,15 @@ msgstr "" ">>> turtle.pos()\n" "(440.00,-0.00)" -#: ../../library/turtle.rst:923 ../../library/turtle.rst:986 +#: ../../library/turtle.rst:927 ../../library/turtle.rst:990 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: ../../library/turtle.rst:924 ../../library/turtle.rst:987 +#: ../../library/turtle.rst:928 ../../library/turtle.rst:991 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: ../../library/turtle.rst:926 +#: ../../library/turtle.rst:930 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1579,7 +1579,7 @@ msgid "" "\"logo\"." msgstr "" -#: ../../library/turtle.rst:930 +#: ../../library/turtle.rst:934 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" @@ -1589,11 +1589,11 @@ msgstr "" ">>> turtle.towards(0,0)\n" "225.0" -#: ../../library/turtle.rst:940 +#: ../../library/turtle.rst:944 msgid "Return the turtle's x coordinate." msgstr "" -#: ../../library/turtle.rst:942 +#: ../../library/turtle.rst:946 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1611,11 +1611,11 @@ msgstr "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" -#: ../../library/turtle.rst:956 +#: ../../library/turtle.rst:960 msgid "Return the turtle's y coordinate." msgstr "" -#: ../../library/turtle.rst:958 +#: ../../library/turtle.rst:962 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1633,13 +1633,13 @@ msgstr "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" -#: ../../library/turtle.rst:972 +#: ../../library/turtle.rst:976 msgid "" -"Return the turtle's current heading (value depends on the turtle mode, " -"see :func:`mode`)." +"Return the turtle's current heading (value depends on the turtle mode, see :" +"func:`mode`)." msgstr "" -#: ../../library/turtle.rst:975 +#: ../../library/turtle.rst:979 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" @@ -1651,13 +1651,13 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:989 +#: ../../library/turtle.rst:993 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: ../../library/turtle.rst:992 +#: ../../library/turtle.rst:996 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1679,17 +1679,17 @@ msgstr "" ">>> turtle.distance(joe)\n" "77.0" -#: ../../library/turtle.rst:1007 +#: ../../library/turtle.rst:1011 msgid "Settings for measurement" msgstr "" -#: ../../library/turtle.rst:1013 +#: ../../library/turtle.rst:1017 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: ../../library/turtle.rst:1016 +#: ../../library/turtle.rst:1020 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1706,13 +1706,13 @@ msgid "" "90.0" msgstr "" -#: ../../library/turtle.rst:1036 +#: ../../library/turtle.rst:1040 msgid "" -"Set the angle measurement units to radians. Equivalent to " -"``degrees(2*math.pi)``." +"Set the angle measurement units to radians. Equivalent to ``degrees(2*math." +"pi)``." msgstr "" -#: ../../library/turtle.rst:1039 +#: ../../library/turtle.rst:1043 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1730,87 +1730,87 @@ msgstr "" ">>> turtle.heading()\n" "1.5707963267948966" -#: ../../library/turtle.rst:1067 +#: ../../library/turtle.rst:1071 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: ../../library/turtle.rst:1074 +#: ../../library/turtle.rst:1078 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: ../../library/turtle.rst:1080 +#: ../../library/turtle.rst:1084 msgid "a positive number" msgstr "" -#: ../../library/turtle.rst:1082 +#: ../../library/turtle.rst:1086 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: ../../library/turtle.rst:1086 +#: ../../library/turtle.rst:1090 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" -#: ../../library/turtle.rst:1096 +#: ../../library/turtle.rst:1100 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: ../../library/turtle.rst:1097 +#: ../../library/turtle.rst:1101 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: ../../library/turtle.rst:1099 +#: ../../library/turtle.rst:1103 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: ../../library/turtle.rst:1102 +#: ../../library/turtle.rst:1106 msgid "\"shown\": True/False" msgstr "" -#: ../../library/turtle.rst:1103 +#: ../../library/turtle.rst:1107 msgid "\"pendown\": True/False" msgstr "" -#: ../../library/turtle.rst:1104 +#: ../../library/turtle.rst:1108 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1105 +#: ../../library/turtle.rst:1109 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1106 +#: ../../library/turtle.rst:1110 msgid "\"pensize\": positive number" msgstr "" -#: ../../library/turtle.rst:1107 +#: ../../library/turtle.rst:1111 msgid "\"speed\": number in range 0..10" msgstr "" -#: ../../library/turtle.rst:1108 +#: ../../library/turtle.rst:1112 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1109 +#: ../../library/turtle.rst:1113 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: ../../library/turtle.rst:1110 +#: ../../library/turtle.rst:1114 msgid "\"outline\": positive number" msgstr "" -#: ../../library/turtle.rst:1111 +#: ../../library/turtle.rst:1115 msgid "\"tilt\": number" msgstr "" -#: ../../library/turtle.rst:1113 +#: ../../library/turtle.rst:1117 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1818,7 +1818,7 @@ msgid "" "attributes in one statement." msgstr "" -#: ../../library/turtle.rst:1118 +#: ../../library/turtle.rst:1122 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1850,11 +1850,11 @@ msgstr "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" -#: ../../library/turtle.rst:1139 +#: ../../library/turtle.rst:1143 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: ../../library/turtle.rst:1141 +#: ../../library/turtle.rst:1145 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1870,62 +1870,64 @@ msgstr "" ">>> turtle.isdown()\n" "True" -#: ../../library/turtle.rst:1157 +#: ../../library/turtle.rst:1163 msgid "Return or set the pencolor." msgstr "" -#: ../../library/turtle.rst:1159 ../../library/turtle.rst:1208 +#: ../../library/turtle.rst:1165 ../../library/turtle.rst:1216 +#: ../../library/turtle.rst:1890 msgid "Four input formats are allowed:" msgstr "" -#: ../../library/turtle.rst:1161 +#: ../../library/turtle.rst:1167 msgid "``pencolor()``" msgstr "``pencolor()``" -#: ../../library/turtle.rst:1162 +#: ../../library/turtle.rst:1168 msgid "" "Return the current pencolor as color specification string or as a tuple (see " -"example). May be used as input to another color/pencolor/fillcolor call." +"example). May be used as input to another color/pencolor/fillcolor/bgcolor " +"call." msgstr "" -#: ../../library/turtle.rst:1166 +#: ../../library/turtle.rst:1172 msgid "``pencolor(colorstring)``" msgstr "``pencolor(colorstring)``" -#: ../../library/turtle.rst:1167 +#: ../../library/turtle.rst:1173 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1170 +#: ../../library/turtle.rst:1176 msgid "``pencolor((r, g, b))``" msgstr "``pencolor((r, g, b))``" -#: ../../library/turtle.rst:1171 +#: ../../library/turtle.rst:1177 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1175 +#: ../../library/turtle.rst:1181 msgid "``pencolor(r, g, b)``" msgstr "``pencolor(r, g, b)``" -#: ../../library/turtle.rst:1176 +#: ../../library/turtle.rst:1182 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1179 +#: ../../library/turtle.rst:1185 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: ../../library/turtle.rst:1182 +#: ../../library/turtle.rst:1188 msgid "" ">>> colormode()\n" "1.0\n" @@ -1963,59 +1965,59 @@ msgstr "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" -#: ../../library/turtle.rst:1206 +#: ../../library/turtle.rst:1214 msgid "Return or set the fillcolor." msgstr "" -#: ../../library/turtle.rst:1210 +#: ../../library/turtle.rst:1218 msgid "``fillcolor()``" msgstr "``fillcolor()``" -#: ../../library/turtle.rst:1211 +#: ../../library/turtle.rst:1219 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" -"fillcolor call." +"fillcolor/bgcolor call." msgstr "" -#: ../../library/turtle.rst:1215 +#: ../../library/turtle.rst:1223 msgid "``fillcolor(colorstring)``" msgstr "``fillcolor(colorstring)``" -#: ../../library/turtle.rst:1216 +#: ../../library/turtle.rst:1224 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1219 +#: ../../library/turtle.rst:1227 msgid "``fillcolor((r, g, b))``" msgstr "``fillcolor((r, g, b))``" -#: ../../library/turtle.rst:1220 +#: ../../library/turtle.rst:1228 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1224 +#: ../../library/turtle.rst:1232 msgid "``fillcolor(r, g, b)``" msgstr "``fillcolor(r, g, b)``" -#: ../../library/turtle.rst:1225 +#: ../../library/turtle.rst:1233 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1228 +#: ../../library/turtle.rst:1236 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: ../../library/turtle.rst:1231 +#: ../../library/turtle.rst:1239 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -2041,55 +2043,55 @@ msgstr "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" -#: ../../library/turtle.rst:1249 +#: ../../library/turtle.rst:1260 msgid "Return or set pencolor and fillcolor." msgstr "" -#: ../../library/turtle.rst:1251 +#: ../../library/turtle.rst:1262 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: ../../library/turtle.rst:1254 +#: ../../library/turtle.rst:1265 msgid "``color()``" msgstr "``color()``" -#: ../../library/turtle.rst:1255 +#: ../../library/turtle.rst:1266 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " -"specification strings or tuples as returned by :func:`pencolor` " -"and :func:`fillcolor`." +"specification strings or tuples as returned by :func:`pencolor` and :func:" +"`fillcolor`." msgstr "" -#: ../../library/turtle.rst:1259 +#: ../../library/turtle.rst:1270 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" -#: ../../library/turtle.rst:1260 +#: ../../library/turtle.rst:1271 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: ../../library/turtle.rst:1263 +#: ../../library/turtle.rst:1274 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" -#: ../../library/turtle.rst:1264 +#: ../../library/turtle.rst:1275 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: ../../library/turtle.rst:1267 +#: ../../library/turtle.rst:1278 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: ../../library/turtle.rst:1270 +#: ../../library/turtle.rst:1281 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -2105,15 +2107,15 @@ msgstr "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" -#: ../../library/turtle.rst:1281 +#: ../../library/turtle.rst:1292 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: ../../library/turtle.rst:1295 +#: ../../library/turtle.rst:1306 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1297 +#: ../../library/turtle.rst:1308 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" @@ -2127,11 +2129,11 @@ msgstr "" "... else:\n" "... turtle.pensize(3)" -#: ../../library/turtle.rst:1308 +#: ../../library/turtle.rst:1319 msgid "Fill the shape drawn in the ``with turtle.fill():`` block." msgstr "" -#: ../../library/turtle.rst:1310 +#: ../../library/turtle.rst:1321 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> with turtle.fill():\n" @@ -2141,13 +2143,13 @@ msgstr "" ">>> with turtle.fill():\n" "... turtle.circle(80)" -#: ../../library/turtle.rst:1317 +#: ../../library/turtle.rst:1328 msgid "" "Using :func:`!fill` is equivalent to adding the :func:`begin_fill` before " "the fill-block and :func:`end_fill` after the fill-block:" msgstr "" -#: ../../library/turtle.rst:1320 ../../library/turtle.rst:1345 +#: ../../library/turtle.rst:1331 ../../library/turtle.rst:1356 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" @@ -2159,15 +2161,15 @@ msgstr "" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" -#: ../../library/turtle.rst:1333 +#: ../../library/turtle.rst:1344 msgid "To be called just before drawing a shape to be filled." msgstr "" -#: ../../library/turtle.rst:1338 +#: ../../library/turtle.rst:1349 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" -#: ../../library/turtle.rst:1340 +#: ../../library/turtle.rst:1351 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " @@ -2175,13 +2177,13 @@ msgid "" "all yellow or have some white regions." msgstr "" -#: ../../library/turtle.rst:1359 +#: ../../library/turtle.rst:1370 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: ../../library/turtle.rst:1362 +#: ../../library/turtle.rst:1373 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2207,30 +2209,30 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:1380 +#: ../../library/turtle.rst:1391 msgid "" "Delete the turtle's drawings from the screen. Do not move turtle. State " "and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: ../../library/turtle.rst:1386 +#: ../../library/turtle.rst:1397 msgid "object to be written to the TurtleScreen" msgstr "" -#: ../../library/turtle.rst:1387 +#: ../../library/turtle.rst:1398 msgid "True/False" msgstr "True/False" -#: ../../library/turtle.rst:1388 +#: ../../library/turtle.rst:1399 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: ../../library/turtle.rst:1389 +#: ../../library/turtle.rst:1400 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: ../../library/turtle.rst:1391 +#: ../../library/turtle.rst:1402 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -2238,44 +2240,44 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: ../../library/turtle.rst:1409 +#: ../../library/turtle.rst:1420 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: ../../library/turtle.rst:1413 +#: ../../library/turtle.rst:1424 msgid ">>> turtle.hideturtle()" msgstr ">>> turtle.hideturtle()" -#: ../../library/turtle.rst:1422 +#: ../../library/turtle.rst:1433 msgid "Make the turtle visible." msgstr "" -#: ../../library/turtle.rst:1424 +#: ../../library/turtle.rst:1435 msgid ">>> turtle.showturtle()" msgstr ">>> turtle.showturtle()" -#: ../../library/turtle.rst:1432 +#: ../../library/turtle.rst:1443 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: ../../library/turtle.rst:1447 +#: ../../library/turtle.rst:1458 msgid "a string which is a valid shapename" msgstr "" -#: ../../library/turtle.rst:1449 +#: ../../library/turtle.rst:1460 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " "shape dictionary. Initially there are the following polygon shapes: " "\"arrow\", \"turtle\", \"circle\", \"square\", \"triangle\", \"classic\". " -"To learn about how to deal with shapes see Screen " -"method :func:`register_shape`." +"To learn about how to deal with shapes see Screen method :func:" +"`register_shape`." msgstr "" -#: ../../library/turtle.rst:1455 +#: ../../library/turtle.rst:1466 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2289,40 +2291,40 @@ msgstr "" ">>> turtle.shape()\n" "'turtle'" -#: ../../library/turtle.rst:1467 +#: ../../library/turtle.rst:1478 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1469 +#: ../../library/turtle.rst:1480 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: ../../library/turtle.rst:1473 +#: ../../library/turtle.rst:1484 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: ../../library/turtle.rst:1474 +#: ../../library/turtle.rst:1485 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: ../../library/turtle.rst:1477 +#: ../../library/turtle.rst:1488 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: ../../library/turtle.rst:1479 +#: ../../library/turtle.rst:1490 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: ../../library/turtle.rst:1481 +#: ../../library/turtle.rst:1492 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2336,12 +2338,12 @@ msgstr "" ">>> turtle.resizemode()\n" "'auto'" -#: ../../library/turtle.rst:1494 ../../library/turtle.rst:1495 -#: ../../library/turtle.rst:1496 +#: ../../library/turtle.rst:1505 ../../library/turtle.rst:1506 +#: ../../library/turtle.rst:1507 msgid "positive number" msgstr "" -#: ../../library/turtle.rst:1498 +#: ../../library/turtle.rst:1509 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -2351,7 +2353,7 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: ../../library/turtle.rst:1505 +#: ../../library/turtle.rst:1516 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2373,12 +2375,12 @@ msgstr "" ">>> turtle.shapesize()\n" "(5, 5, 8)" -#: ../../library/turtle.rst:1521 ../../library/turtle.rst:2193 -#: ../../library/turtle.rst:2194 ../../library/turtle.rst:2195 +#: ../../library/turtle.rst:1532 ../../library/turtle.rst:2223 +#: ../../library/turtle.rst:2224 ../../library/turtle.rst:2225 msgid "number (optional)" msgstr "" -#: ../../library/turtle.rst:1523 +#: ../../library/turtle.rst:1534 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2387,7 +2389,7 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: ../../library/turtle.rst:1530 +#: ../../library/turtle.rst:1541 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2401,13 +2403,13 @@ msgstr "" ">>> turtle.shearfactor()\n" "0.5" -#: ../../library/turtle.rst:1544 +#: ../../library/turtle.rst:1555 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: ../../library/turtle.rst:1547 +#: ../../library/turtle.rst:1558 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2425,13 +2427,13 @@ msgstr "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:1561 ../../library/turtle.rst:1584 -#: ../../library/turtle.rst:1585 ../../library/turtle.rst:1586 -#: ../../library/turtle.rst:1587 +#: ../../library/turtle.rst:1572 ../../library/turtle.rst:1595 +#: ../../library/turtle.rst:1596 ../../library/turtle.rst:1597 +#: ../../library/turtle.rst:1598 msgid "a number (optional)" msgstr "" -#: ../../library/turtle.rst:1563 +#: ../../library/turtle.rst:1574 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2441,7 +2443,7 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: ../../library/turtle.rst:1571 +#: ../../library/turtle.rst:1582 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2457,11 +2459,11 @@ msgstr "" ">>> turtle.tiltangle()\n" "45.0" -#: ../../library/turtle.rst:1589 +#: ../../library/turtle.rst:1600 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: ../../library/turtle.rst:1591 +#: ../../library/turtle.rst:1602 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2471,7 +2473,7 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: ../../library/turtle.rst:1600 +#: ../../library/turtle.rst:1611 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2487,13 +2489,13 @@ msgstr "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1613 +#: ../../library/turtle.rst:1624 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: ../../library/turtle.rst:1616 +#: ../../library/turtle.rst:1627 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" @@ -2505,33 +2507,33 @@ msgstr "" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" -#: ../../library/turtle.rst:1631 ../../library/turtle.rst:1653 -#: ../../library/turtle.rst:1678 ../../library/turtle.rst:2117 +#: ../../library/turtle.rst:1642 ../../library/turtle.rst:1664 +#: ../../library/turtle.rst:1689 ../../library/turtle.rst:2147 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: ../../library/turtle.rst:1633 ../../library/turtle.rst:1655 -#: ../../library/turtle.rst:1680 ../../library/turtle.rst:2119 +#: ../../library/turtle.rst:1644 ../../library/turtle.rst:1666 +#: ../../library/turtle.rst:1691 ../../library/turtle.rst:2149 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: ../../library/turtle.rst:1634 ../../library/turtle.rst:1656 -#: ../../library/turtle.rst:1681 ../../library/turtle.rst:2120 +#: ../../library/turtle.rst:1645 ../../library/turtle.rst:1667 +#: ../../library/turtle.rst:1692 ../../library/turtle.rst:2150 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: ../../library/turtle.rst:1637 +#: ../../library/turtle.rst:1648 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: ../../library/turtle.rst:1641 +#: ../../library/turtle.rst:1652 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2540,13 +2542,13 @@ msgid "" ">>> onclick(None) # event-binding will be removed" msgstr "" -#: ../../library/turtle.rst:1659 +#: ../../library/turtle.rst:1670 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1662 +#: ../../library/turtle.rst:1673 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2560,35 +2562,35 @@ msgid "" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" -#: ../../library/turtle.rst:1684 +#: ../../library/turtle.rst:1695 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1687 +#: ../../library/turtle.rst:1698 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: ../../library/turtle.rst:1690 +#: ../../library/turtle.rst:1701 msgid ">>> turtle.ondrag(turtle.goto)" msgstr ">>> turtle.ondrag(turtle.goto)" -#: ../../library/turtle.rst:1695 +#: ../../library/turtle.rst:1706 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: ../../library/turtle.rst:1705 +#: ../../library/turtle.rst:1716 msgid "" "Record the vertices of a polygon drawn in the ``with turtle.poly():`` block. " "The first and last vertices will be connected." msgstr "" -#: ../../library/turtle.rst:1708 +#: ../../library/turtle.rst:1719 msgid "" ">>> with turtle.poly():\n" "... turtle.forward(100)\n" @@ -2600,23 +2602,23 @@ msgstr "" "... turtle.right(60)\n" "... turtle.forward(100)" -#: ../../library/turtle.rst:1721 +#: ../../library/turtle.rst:1732 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: ../../library/turtle.rst:1727 +#: ../../library/turtle.rst:1738 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: ../../library/turtle.rst:1733 +#: ../../library/turtle.rst:1744 msgid "Return the last recorded polygon." msgstr "" -#: ../../library/turtle.rst:1735 +#: ../../library/turtle.rst:1746 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2640,13 +2642,13 @@ msgstr "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" -#: ../../library/turtle.rst:1752 +#: ../../library/turtle.rst:1763 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: ../../library/turtle.rst:1755 +#: ../../library/turtle.rst:1766 msgid "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" @@ -2654,13 +2656,13 @@ msgstr "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" -#: ../../library/turtle.rst:1765 +#: ../../library/turtle.rst:1776 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: ../../library/turtle.rst:1768 +#: ../../library/turtle.rst:1779 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" @@ -2672,13 +2674,13 @@ msgstr "" ">>> pet\n" "" -#: ../../library/turtle.rst:1779 +#: ../../library/turtle.rst:1790 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: ../../library/turtle.rst:1782 +#: ../../library/turtle.rst:1793 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" @@ -2690,11 +2692,11 @@ msgstr "" "\n" ">>> ts.bgcolor(\"pink\")" -#: ../../library/turtle.rst:1793 +#: ../../library/turtle.rst:1804 msgid "an integer or ``None``" msgstr "一個整數或 ``None``" -#: ../../library/turtle.rst:1795 +#: ../../library/turtle.rst:1806 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -2702,15 +2704,15 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: ../../library/turtle.rst:1800 +#: ../../library/turtle.rst:1811 msgid ">>> turtle.setundobuffer(42)" msgstr ">>> turtle.setundobuffer(42)" -#: ../../library/turtle.rst:1808 +#: ../../library/turtle.rst:1819 msgid "Return number of entries in the undobuffer." msgstr "" -#: ../../library/turtle.rst:1810 +#: ../../library/turtle.rst:1821 msgid "" ">>> while undobufferentries():\n" "... undo()" @@ -2718,32 +2720,32 @@ msgstr "" ">>> while undobufferentries():\n" "... undo()" -#: ../../library/turtle.rst:1821 +#: ../../library/turtle.rst:1832 msgid "Compound shapes" msgstr "" -#: ../../library/turtle.rst:1823 +#: ../../library/turtle.rst:1834 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: ../../library/turtle.rst:1827 +#: ../../library/turtle.rst:1838 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: ../../library/turtle.rst:1828 +#: ../../library/turtle.rst:1839 msgid "" -"Add as many components to this object as desired, using " -"the :meth:`~Shape.addcomponent` method." +"Add as many components to this object as desired, using the :meth:`~Shape." +"addcomponent` method." msgstr "" -#: ../../library/turtle.rst:1831 +#: ../../library/turtle.rst:1842 msgid "For example:" msgstr "舉例來說:" -#: ../../library/turtle.rst:1833 +#: ../../library/turtle.rst:1844 msgid "" ">>> s = Shape(\"compound\")\n" ">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" @@ -2757,11 +2759,11 @@ msgstr "" ">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" ">>> s.addcomponent(poly2, \"blue\", \"red\")" -#: ../../library/turtle.rst:1842 +#: ../../library/turtle.rst:1853 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: ../../library/turtle.rst:1844 +#: ../../library/turtle.rst:1855 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" @@ -2769,34 +2771,70 @@ msgstr "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" -#: ../../library/turtle.rst:1853 +#: ../../library/turtle.rst:1864 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: ../../library/turtle.rst:1859 +#: ../../library/turtle.rst:1870 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: ../../library/turtle.rst:1861 +#: ../../library/turtle.rst:1872 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: ../../library/turtle.rst:1875 +#: ../../library/turtle.rst:1888 +msgid "Return or set the background color of the TurtleScreen." +msgstr "" + +#: ../../library/turtle.rst:1892 +msgid "``bgcolor()``" +msgstr "``bgcolor()``" + +#: ../../library/turtle.rst:1893 +msgid "" +"Return the current background color as color specification string or as a " +"tuple (see example). May be used as input to another color/pencolor/" +"fillcolor/bgcolor call." +msgstr "" + +#: ../../library/turtle.rst:1897 +msgid "``bgcolor(colorstring)``" +msgstr "``bgcolor(colorstring)``" + +#: ../../library/turtle.rst:1898 msgid "" -"a color string or three numbers in the range 0..colormode or a 3-tuple of " -"such numbers" +"Set the background color to *colorstring*, which is a Tk color specification " +"string, such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1879 -msgid "Set or return background color of the TurtleScreen." +#: ../../library/turtle.rst:1901 +msgid "``bgcolor((r, g, b))``" +msgstr "``bgcolor((r, g, b))``" + +#: ../../library/turtle.rst:1902 +msgid "" +"Set the background color to the RGB color represented by the tuple of *r*, " +"*g*, and *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, " +"where colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1881 +#: ../../library/turtle.rst:1907 +msgid "``bgcolor(r, g, b)``" +msgstr "``bgcolor(r, g, b)``" + +#: ../../library/turtle.rst:1908 +msgid "" +"Set the background color to the RGB color represented by *r*, *g*, and *b*. " +"Each of *r*, *g*, and *b* must be in the range 0..colormode." +msgstr "" + +#: ../../library/turtle.rst:1911 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2812,13 +2850,13 @@ msgstr "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1894 +#: ../../library/turtle.rst:1924 msgid "" "a string, name of an image file (PNG, GIF, PGM, and PPM) or ``\"nopic\"``, " "or ``None``" msgstr "" -#: ../../library/turtle.rst:1897 +#: ../../library/turtle.rst:1927 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -2826,7 +2864,7 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: ../../library/turtle.rst:1902 +#: ../../library/turtle.rst:1932 msgid "" ">>> screen.bgpic()\n" "'nopic'\n" @@ -2840,44 +2878,44 @@ msgstr "" ">>> screen.bgpic()\n" "\"landscape.gif\"" -#: ../../library/turtle.rst:1913 +#: ../../library/turtle.rst:1943 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: ../../library/turtle.rst:1920 +#: ../../library/turtle.rst:1950 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: ../../library/turtle.rst:1929 +#: ../../library/turtle.rst:1959 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: ../../library/turtle.rst:1936 +#: ../../library/turtle.rst:1966 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: ../../library/turtle.rst:1941 +#: ../../library/turtle.rst:1971 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1942 +#: ../../library/turtle.rst:1972 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1943 +#: ../../library/turtle.rst:1973 msgid "colorstring or color-tuple, new background color" msgstr "" -#: ../../library/turtle.rst:1945 +#: ../../library/turtle.rst:1975 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -2886,40 +2924,40 @@ msgid "" "outside the canvas before." msgstr "" -#: ../../library/turtle.rst:1957 +#: ../../library/turtle.rst:1987 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: ../../library/turtle.rst:1962 +#: ../../library/turtle.rst:1992 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1963 +#: ../../library/turtle.rst:1993 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1964 +#: ../../library/turtle.rst:1994 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1965 +#: ../../library/turtle.rst:1995 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1967 +#: ../../library/turtle.rst:1997 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: ../../library/turtle.rst:1971 +#: ../../library/turtle.rst:2001 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: ../../library/turtle.rst:1974 +#: ../../library/turtle.rst:2004 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2929,15 +2967,22 @@ msgid "" ">>> for _ in range(8):\n" "... left(45); fd(2) # a regular octagon" msgstr "" +">>> screen.reset()\n" +">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" +">>> for _ in range(72):\n" +"... left(10)\n" +"...\n" +">>> for _ in range(8):\n" +"... left(45); fd(2) # 一個一般的八邊形" -#: ../../library/turtle.rst:1999 +#: ../../library/turtle.rst:2029 msgid "" "Temporarily disable turtle animation. The code written inside the " "``no_animation`` block will not be animated; once the code block is exited, " "the drawing will appear." msgstr "" -#: ../../library/turtle.rst:2003 +#: ../../library/turtle.rst:2033 msgid "" ">>> with screen.no_animation():\n" "... for dist in range(2, 400, 2):\n" @@ -2949,22 +2994,22 @@ msgstr "" "... fd(dist)\n" "... rt(90)" -#: ../../library/turtle.rst:2016 +#: ../../library/turtle.rst:2046 msgid "positive integer" -msgstr "" +msgstr "正整數" -#: ../../library/turtle.rst:2018 +#: ../../library/turtle.rst:2048 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: ../../library/turtle.rst:2022 +#: ../../library/turtle.rst:2052 msgid "Optional argument:" -msgstr "" +msgstr "可選引數: ::" -#: ../../library/turtle.rst:2024 +#: ../../library/turtle.rst:2054 msgid "" ">>> screen.delay()\n" "10\n" @@ -2978,11 +3023,11 @@ msgstr "" ">>> screen.delay()\n" "5" -#: ../../library/turtle.rst:2036 ../../library/turtle.rst:2037 +#: ../../library/turtle.rst:2066 ../../library/turtle.rst:2067 msgid "nonnegative integer" -msgstr "" +msgstr "非負整數" -#: ../../library/turtle.rst:2039 +#: ../../library/turtle.rst:2069 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -2991,7 +3036,7 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: ../../library/turtle.rst:2046 +#: ../../library/turtle.rst:2076 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -3007,37 +3052,37 @@ msgstr "" "... rt(90)\n" "... dist += 2" -#: ../../library/turtle.rst:2059 +#: ../../library/turtle.rst:2089 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: ../../library/turtle.rst:2061 +#: ../../library/turtle.rst:2091 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "另請參閱 RawTurtle/Turtle 的 :func:`speed` 方法。" -#: ../../library/turtle.rst:2069 +#: ../../library/turtle.rst:2099 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: ../../library/turtle.rst:2076 ../../library/turtle.rst:2096 +#: ../../library/turtle.rst:2106 ../../library/turtle.rst:2126 msgid "a function with no arguments or ``None``" msgstr "" -#: ../../library/turtle.rst:2077 ../../library/turtle.rst:2097 +#: ../../library/turtle.rst:2107 ../../library/turtle.rst:2127 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: ../../library/turtle.rst:2079 +#: ../../library/turtle.rst:2109 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2083 +#: ../../library/turtle.rst:2113 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -3053,14 +3098,14 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2099 +#: ../../library/turtle.rst:2129 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2104 +#: ../../library/turtle.rst:2134 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -3074,19 +3119,19 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2123 +#: ../../library/turtle.rst:2153 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:2126 +#: ../../library/turtle.rst:2156 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: ../../library/turtle.rst:2129 +#: ../../library/turtle.rst:2159 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -3095,26 +3140,26 @@ msgid "" ">>> screen.onclick(None) # remove event binding again" msgstr "" -#: ../../library/turtle.rst:2137 +#: ../../library/turtle.rst:2167 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: ../../library/turtle.rst:2144 +#: ../../library/turtle.rst:2174 msgid "a function with no arguments" msgstr "" -#: ../../library/turtle.rst:2145 +#: ../../library/turtle.rst:2175 msgid "a number >= 0" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2177 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2179 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -3126,7 +3171,7 @@ msgid "" ">>> running = False" msgstr "" -#: ../../library/turtle.rst:2165 +#: ../../library/turtle.rst:2195 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -3134,16 +3179,16 @@ msgid "" "turtle graphics. ::" msgstr "" -#: ../../library/turtle.rst:2170 +#: ../../library/turtle.rst:2200 msgid ">>> screen.mainloop()" msgstr ">>> screen.mainloop()" -#: ../../library/turtle.rst:2178 ../../library/turtle.rst:2179 -#: ../../library/turtle.rst:2191 ../../library/turtle.rst:2192 +#: ../../library/turtle.rst:2208 ../../library/turtle.rst:2209 +#: ../../library/turtle.rst:2221 ../../library/turtle.rst:2222 msgid "string" msgstr "string(字串)" -#: ../../library/turtle.rst:2181 +#: ../../library/turtle.rst:2211 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -3151,11 +3196,11 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2186 +#: ../../library/turtle.rst:2216 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -#: ../../library/turtle.rst:2197 +#: ../../library/turtle.rst:2227 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -3166,7 +3211,7 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2206 +#: ../../library/turtle.rst:2236 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" @@ -3174,17 +3219,17 @@ msgstr "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" -#: ../../library/turtle.rst:2214 +#: ../../library/turtle.rst:2244 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: ../../library/turtle.rst:2216 +#: ../../library/turtle.rst:2246 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: ../../library/turtle.rst:2219 +#: ../../library/turtle.rst:2249 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -3192,60 +3237,60 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "Mode" msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "Initial turtle heading" msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "positive angles" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "\"standard\"" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "to the right (east)" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "counterclockwise" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "\"logo\"" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "upward (north)" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "clockwise" msgstr "" -#: ../../library/turtle.rst:2231 +#: ../../library/turtle.rst:2261 msgid "" ">>> mode(\"logo\") # resets turtle heading to north\n" ">>> mode()\n" "'logo'" msgstr "" -#: ../../library/turtle.rst:2241 +#: ../../library/turtle.rst:2271 msgid "one of the values 1.0 or 255" msgstr "" -#: ../../library/turtle.rst:2243 +#: ../../library/turtle.rst:2273 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: ../../library/turtle.rst:2246 +#: ../../library/turtle.rst:2276 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3271,13 +3316,13 @@ msgstr "" "255\n" ">>> turtle.pencolor(240,160,80)" -#: ../../library/turtle.rst:2264 +#: ../../library/turtle.rst:2294 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: ../../library/turtle.rst:2267 +#: ../../library/turtle.rst:2297 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" @@ -3287,11 +3332,11 @@ msgstr "" ">>> cv\n" "" -#: ../../library/turtle.rst:2277 +#: ../../library/turtle.rst:2307 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: ../../library/turtle.rst:2279 +#: ../../library/turtle.rst:2309 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" @@ -3299,69 +3344,69 @@ msgstr "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" -#: ../../library/turtle.rst:2289 +#: ../../library/turtle.rst:2319 msgid "There are four different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2291 +#: ../../library/turtle.rst:2321 msgid "" "*name* is the name of an image file (PNG, GIF, PGM, and PPM) and *shape* is " "``None``: Install the corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2294 +#: ../../library/turtle.rst:2324 msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle.gif\")" -#: ../../library/turtle.rst:2297 ../../library/turtle.rst:2306 +#: ../../library/turtle.rst:2327 ../../library/turtle.rst:2336 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: ../../library/turtle.rst:2300 +#: ../../library/turtle.rst:2330 msgid "" "*name* is an arbitrary string and *shape* is the name of an image file (PNG, " "GIF, PGM, and PPM): Install the corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2303 +#: ../../library/turtle.rst:2333 msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" -#: ../../library/turtle.rst:2309 +#: ../../library/turtle.rst:2339 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: ../../library/turtle.rst:2312 +#: ../../library/turtle.rst:2342 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -#: ../../library/turtle.rst:2317 +#: ../../library/turtle.rst:2347 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: ../../library/turtle.rst:2320 +#: ../../library/turtle.rst:2350 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: ../../library/turtle.rst:2323 +#: ../../library/turtle.rst:2353 msgid "" "Added support for PNG, PGM, and PPM image formats. Both a shape name and an " "image file name can be specified." msgstr "" -#: ../../library/turtle.rst:2330 +#: ../../library/turtle.rst:2360 msgid "Return the list of turtles on the screen." msgstr "" -#: ../../library/turtle.rst:2332 +#: ../../library/turtle.rst:2362 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" @@ -3369,11 +3414,11 @@ msgstr "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" -#: ../../library/turtle.rst:2341 +#: ../../library/turtle.rst:2371 msgid "Return the height of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2343 +#: ../../library/turtle.rst:2373 msgid "" ">>> screen.window_height()\n" "480" @@ -3381,11 +3426,11 @@ msgstr "" ">>> screen.window_height()\n" "480" -#: ../../library/turtle.rst:2349 +#: ../../library/turtle.rst:2379 msgid "Return the width of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2351 +#: ../../library/turtle.rst:2381 msgid "" ">>> screen.window_width()\n" "640" @@ -3393,43 +3438,43 @@ msgstr "" ">>> screen.window_width()\n" "640" -#: ../../library/turtle.rst:2358 +#: ../../library/turtle.rst:2388 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2392 msgid "Shut the turtlegraphics window." msgstr "" -#: ../../library/turtle.rst:2367 +#: ../../library/turtle.rst:2397 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: ../../library/turtle.rst:2370 +#: ../../library/turtle.rst:2400 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " -"switch (no subprocess) is used, this value should be set to ``True`` " -"in :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for " -"the client script." +"switch (no subprocess) is used, this value should be set to ``True`` in :" +"file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the " +"client script." msgstr "" -#: ../../library/turtle.rst:2379 +#: ../../library/turtle.rst:2409 msgid "Save the current turtle drawing (and turtles) as a PostScript file." msgstr "" -#: ../../library/turtle.rst:2381 +#: ../../library/turtle.rst:2411 msgid "the path of the saved PostScript file" msgstr "" -#: ../../library/turtle.rst:2382 +#: ../../library/turtle.rst:2412 msgid "" "if ``False`` and there already exists a file with the given filename, then " "the function will raise a ``FileExistsError``. If it is ``True``, the file " "will be overwritten." msgstr "" -#: ../../library/turtle.rst:2387 +#: ../../library/turtle.rst:2417 msgid "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" @@ -3437,38 +3482,38 @@ msgstr "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" -#: ../../library/turtle.rst:2397 +#: ../../library/turtle.rst:2427 msgid "" "Set the size and position of the main window. Default values of arguments " -"are stored in the configuration dictionary and can be changed via " -"a :file:`turtle.cfg` file." +"are stored in the configuration dictionary and can be changed via a :file:" +"`turtle.cfg` file." msgstr "" -#: ../../library/turtle.rst:2401 +#: ../../library/turtle.rst:2431 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: ../../library/turtle.rst:2403 +#: ../../library/turtle.rst:2433 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: ../../library/turtle.rst:2405 +#: ../../library/turtle.rst:2435 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: ../../library/turtle.rst:2408 +#: ../../library/turtle.rst:2438 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: ../../library/turtle.rst:2412 +#: ../../library/turtle.rst:2442 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" @@ -3476,129 +3521,128 @@ msgid "" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" -#: ../../library/turtle.rst:2423 +#: ../../library/turtle.rst:2453 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: ../../library/turtle.rst:2426 +#: ../../library/turtle.rst:2456 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: ../../library/turtle.rst:2428 +#: ../../library/turtle.rst:2458 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2435 +#: ../../library/turtle.rst:2465 msgid "Public classes" msgstr "" -#: ../../library/turtle.rst:2441 +#: ../../library/turtle.rst:2471 msgid "" -"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " -"a :class:`TurtleScreen`" +"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" +"`TurtleScreen`" msgstr "" -#: ../../library/turtle.rst:2444 +#: ../../library/turtle.rst:2474 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: ../../library/turtle.rst:2450 +#: ../../library/turtle.rst:2480 msgid "" -"Subclass of RawTurtle, has the same interface but draws on a " -"default :class:`Screen` object created automatically when needed for the " -"first time." +"Subclass of RawTurtle, has the same interface but draws on a default :class:" +"`Screen` object created automatically when needed for the first time." msgstr "" -#: ../../library/turtle.rst:2456 +#: ../../library/turtle.rst:2486 msgid "a :class:`!tkinter.Canvas`" msgstr "一個 :class:`!tkinter.Canvas`" -#: ../../library/turtle.rst:2458 +#: ../../library/turtle.rst:2488 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: ../../library/turtle.rst:2463 +#: ../../library/turtle.rst:2493 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: ../../library/turtle.rst:2468 +#: ../../library/turtle.rst:2498 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: ../../library/turtle.rst:2471 +#: ../../library/turtle.rst:2501 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: ../../library/turtle.rst:2476 +#: ../../library/turtle.rst:2506 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: ../../library/turtle.rst:2478 +#: ../../library/turtle.rst:2508 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: ../../library/turtle.rst:2483 +#: ../../library/turtle.rst:2513 msgid "*type_*" msgstr "*type_*" -#: ../../library/turtle.rst:2483 +#: ../../library/turtle.rst:2513 msgid "*data*" msgstr "*data*" -#: ../../library/turtle.rst:2485 +#: ../../library/turtle.rst:2515 msgid "\"polygon\"" msgstr "\"polygon\"" -#: ../../library/turtle.rst:2485 +#: ../../library/turtle.rst:2515 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: ../../library/turtle.rst:2486 +#: ../../library/turtle.rst:2516 msgid "\"image\"" msgstr "\"image\"" -#: ../../library/turtle.rst:2486 +#: ../../library/turtle.rst:2516 msgid "an image (in this form only used internally!)" msgstr "" -#: ../../library/turtle.rst:2487 +#: ../../library/turtle.rst:2517 msgid "\"compound\"" msgstr "\"compound\"" -#: ../../library/turtle.rst:2487 +#: ../../library/turtle.rst:2517 msgid "" -"``None`` (a compound shape has to be constructed using " -"the :meth:`addcomponent` method)" +"``None`` (a compound shape has to be constructed using the :meth:" +"`addcomponent` method)" msgstr "" -#: ../../library/turtle.rst:2493 +#: ../../library/turtle.rst:2523 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: ../../library/turtle.rst:2494 +#: ../../library/turtle.rst:2524 msgid "a color the *poly* will be filled with" msgstr "" -#: ../../library/turtle.rst:2495 +#: ../../library/turtle.rst:2525 msgid "a color for the poly's outline (if given)" msgstr "" -#: ../../library/turtle.rst:2497 +#: ../../library/turtle.rst:2527 msgid "Example:" msgstr "例如:" -#: ../../library/turtle.rst:2499 +#: ../../library/turtle.rst:2529 msgid "" ">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" ">>> s = Shape(\"compound\")\n" @@ -3606,81 +3650,80 @@ msgid "" ">>> # ... add more components and then use register_shape()" msgstr "" -#: ../../library/turtle.rst:2507 +#: ../../library/turtle.rst:2537 msgid "See :ref:`compoundshapes`." msgstr "請見\\ :ref:`compoundshapes`。" -#: ../../library/turtle.rst:2512 +#: ../../library/turtle.rst:2542 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: ../../library/turtle.rst:2516 +#: ../../library/turtle.rst:2546 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: ../../library/turtle.rst:2518 +#: ../../library/turtle.rst:2548 msgid "``a + b`` vector addition" msgstr "``a + b`` 向量加法" -#: ../../library/turtle.rst:2519 +#: ../../library/turtle.rst:2549 msgid "``a - b`` vector subtraction" msgstr "``a - b`` 向量減法" -#: ../../library/turtle.rst:2520 +#: ../../library/turtle.rst:2550 msgid "``a * b`` inner product" msgstr "``a * b`` 內積" -#: ../../library/turtle.rst:2521 +#: ../../library/turtle.rst:2551 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: ../../library/turtle.rst:2522 +#: ../../library/turtle.rst:2552 msgid "``abs(a)`` absolute value of a" msgstr "``abs(a)`` a 的絕對值" -#: ../../library/turtle.rst:2523 +#: ../../library/turtle.rst:2553 msgid "``a.rotate(angle)`` rotation" msgstr "``a.rotate(angle)`` 旋轉" -#: ../../library/turtle.rst:2529 +#: ../../library/turtle.rst:2559 msgid "Explanation" msgstr "解釋" -#: ../../library/turtle.rst:2531 +#: ../../library/turtle.rst:2561 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: ../../library/turtle.rst:2535 +#: ../../library/turtle.rst:2565 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: ../../library/turtle.rst:2538 +#: ../../library/turtle.rst:2568 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " -"or created for it. The *canvas* can be a :class:`!" -"tkinter.Canvas`, :class:`ScrolledCanvas` or :class:`TurtleScreen`." +"or created for it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:" +"`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: ../../library/turtle.rst:2544 +#: ../../library/turtle.rst:2574 msgid "" -":class:`TurtleScreen` is the basic drawing surface for a " -"turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " -"includes :ref:`some additional methods ` for managing its " -"appearance (including size and title) and behaviour. ``TurtleScreen``'s " -"constructor needs a :class:`!tkinter.Canvas` or a :class:`ScrolledCanvas` as " -"an argument." +":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" +"`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " +"additional methods ` for managing its appearance (including " +"size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" +"`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" -#: ../../library/turtle.rst:2551 +#: ../../library/turtle.rst:2581 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3689,38 +3732,38 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: ../../library/turtle.rst:2557 +#: ../../library/turtle.rst:2587 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: ../../library/turtle.rst:2562 +#: ../../library/turtle.rst:2592 msgid "Help and configuration" msgstr "" -#: ../../library/turtle.rst:2565 +#: ../../library/turtle.rst:2595 msgid "How to use help" msgstr "" -#: ../../library/turtle.rst:2567 +#: ../../library/turtle.rst:2597 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: ../../library/turtle.rst:2571 +#: ../../library/turtle.rst:2601 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: ../../library/turtle.rst:2574 +#: ../../library/turtle.rst:2604 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: ../../library/turtle.rst:2576 +#: ../../library/turtle.rst:2606 msgid "" ">>> help(Screen.bgcolor)\n" "Help on method bgcolor in module turtle:\n" @@ -3780,13 +3823,13 @@ msgstr "" "\n" " >>> turtle.penup()" -#: ../../library/turtle.rst:2605 +#: ../../library/turtle.rst:2635 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: ../../library/turtle.rst:2608 +#: ../../library/turtle.rst:2638 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3850,28 +3893,28 @@ msgstr "" " Example:\n" " >>> penup()" -#: ../../library/turtle.rst:2639 +#: ../../library/turtle.rst:2669 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: ../../library/turtle.rst:2644 +#: ../../library/turtle.rst:2674 msgid "Translation of docstrings into different languages" msgstr "" -#: ../../library/turtle.rst:2646 +#: ../../library/turtle.rst:2676 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: ../../library/turtle.rst:2652 +#: ../../library/turtle.rst:2682 msgid "a string, used as filename" msgstr "" -#: ../../library/turtle.rst:2654 +#: ../../library/turtle.rst:2684 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -3880,37 +3923,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: ../../library/turtle.rst:2660 +#: ../../library/turtle.rst:2690 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2694 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: ../../library/turtle.rst:2667 +#: ../../library/turtle.rst:2697 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: ../../library/turtle.rst:2673 +#: ../../library/turtle.rst:2703 msgid "How to configure Screen and Turtles" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2705 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2708 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -3919,12 +3962,12 @@ msgid "" "settings." msgstr "" -#: ../../library/turtle.rst:2683 +#: ../../library/turtle.rst:2713 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: ../../library/turtle.rst:2685 +#: ../../library/turtle.rst:2715 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3968,50 +4011,49 @@ msgstr "" "title = Python Turtle Graphics\n" "using_IDLE = False" -#: ../../library/turtle.rst:2708 +#: ../../library/turtle.rst:2738 msgid "Short explanation of selected entries:" msgstr "" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2740 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: ../../library/turtle.rst:2712 +#: ../../library/turtle.rst:2742 msgid "" -"Line 5 and 6 correspond to the arguments of the " -"method :func:`Screen.screensize `." +"Line 5 and 6 correspond to the arguments of the method :func:`Screen." +"screensize `." msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2744 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: ../../library/turtle.rst:2716 +#: ../../library/turtle.rst:2746 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: ../../library/turtle.rst:2719 +#: ../../library/turtle.rst:2749 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: ../../library/turtle.rst:2721 +#: ../../library/turtle.rst:2751 msgid "" -"If you set e.g. ``language = italian`` the " -"docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " -"import time (if present on the import path, e.g. in the same directory " -"as :mod:`turtle`)." +"If you set e.g. ``language = italian`` the docstringdict :file:" +"`turtle_docstringdict_italian.py` will be loaded at import time (if present " +"on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" -#: ../../library/turtle.rst:2724 +#: ../../library/turtle.rst:2754 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -4019,309 +4061,309 @@ msgid "" "docstrings." msgstr "" -#: ../../library/turtle.rst:2728 +#: ../../library/turtle.rst:2758 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: ../../library/turtle.rst:2732 +#: ../../library/turtle.rst:2762 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: ../../library/turtle.rst:2736 +#: ../../library/turtle.rst:2766 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: ../../library/turtle.rst:2742 +#: ../../library/turtle.rst:2772 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: ../../library/turtle.rst:2747 +#: ../../library/turtle.rst:2777 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: ../../library/turtle.rst:2750 +#: ../../library/turtle.rst:2780 msgid "python -m turtledemo" msgstr "python -m turtledemo" -#: ../../library/turtle.rst:2752 +#: ../../library/turtle.rst:2782 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: ../../library/turtle.rst:2754 +#: ../../library/turtle.rst:2784 msgid "python -m turtledemo.bytedesign" msgstr "python -m turtledemo.bytedesign" -#: ../../library/turtle.rst:2756 +#: ../../library/turtle.rst:2786 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: ../../library/turtle.rst:2758 +#: ../../library/turtle.rst:2788 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: ../../library/turtle.rst:2760 +#: ../../library/turtle.rst:2790 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: ../../library/turtle.rst:2763 +#: ../../library/turtle.rst:2793 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: ../../library/turtle.rst:2766 +#: ../../library/turtle.rst:2796 msgid "The demo scripts are:" msgstr "" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Name" msgstr "" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Description" msgstr "描述" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Features" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid "bytedesign" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid "complex classical turtle graphics pattern" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid ":func:`tracer`, delay, :func:`update`" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "chaos" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "world coordinates" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "clock" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "analog clock showing time of your computer" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "turtles as clock's hands, ontimer" msgstr "" -#: ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:2817 msgid "colormixer" msgstr "" -#: ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:2817 msgid "experiment with r, g, b" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "forest" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "3 breadth-first trees" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "randomization" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "fractalcurves" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "Hilbert & Koch curves" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "recursion" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "lindenmayer" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "ethnomathematics (indian kolams)" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "L-System" msgstr "" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "minimal_hanoi" msgstr "minimal_hanoi" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "Towers of Hanoi" -msgstr "" +msgstr "河內塔" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" msgstr "" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "nim" -msgstr "" +msgstr "nim" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:2834 msgid "paint" msgstr "" -#: ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:2834 msgid "super minimalistic drawing program" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "peace" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "elementary" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "turtle: appearance and animation" msgstr "" -#: ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:2840 msgid "penrose" msgstr "" -#: ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:2840 msgid "aperiodic tiling with kites and darts" msgstr "" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "planet_and_moon" msgstr "planet_and_moon" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "simulation of gravitational system" msgstr "" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid "rosette" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid ":func:`clone`, :func:`undo`" msgstr ":func:`clone`, :func:`undo`" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "round_dance" msgstr "round_dance" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" msgstr "" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "sorting_animate" msgstr "sorting_animate" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "visual demonstration of different sorting methods" msgstr "" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "simple alignment, randomization" msgstr "" -#: ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:2856 msgid "tree" msgstr "" -#: ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:2856 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "two_canvases" msgstr "two_canvases" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "simple design" msgstr "" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "turtles on two canvases" msgstr "" -#: ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:2862 msgid "yinyang" msgstr "" -#: ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:2862 msgid "another elementary example" msgstr "" -#: ../../library/turtle.rst:2835 +#: ../../library/turtle.rst:2865 msgid "Have fun!" msgstr "" -#: ../../library/turtle.rst:2839 +#: ../../library/turtle.rst:2869 msgid "Changes since Python 2.6" msgstr "" -#: ../../library/turtle.rst:2841 +#: ../../library/turtle.rst:2871 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -4332,14 +4374,14 @@ msgid "" "methods.)" msgstr "" -#: ../../library/turtle.rst:2849 +#: ../../library/turtle.rst:2879 msgid "" -"The method :func:`!Turtle.fill` has been eliminated. The behaviour " -"of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " -"filling process must be completed with an ``end_fill()`` call." +"The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" +"`begin_fill` and :func:`end_fill` have changed slightly: now every filling " +"process must be completed with an ``end_fill()`` call." msgstr "" -#: ../../library/turtle.rst:2854 +#: ../../library/turtle.rst:2884 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -4347,38 +4389,38 @@ msgid "" "in Python 2.6." msgstr "" -#: ../../library/turtle.rst:2860 +#: ../../library/turtle.rst:2890 msgid "Changes since Python 3.0" msgstr "" -#: ../../library/turtle.rst:2862 +#: ../../library/turtle.rst:2892 msgid "" -"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " -"and :func:`get_shapepoly` have been added. Thus the full range of regular " -"linear transforms is now available for transforming turtle " -"shapes. :func:`tiltangle` has been enhanced in functionality: it now can be " -"used to get or set the tilt angle." +"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" +"func:`get_shapepoly` have been added. Thus the full range of regular linear " +"transforms is now available for transforming turtle shapes. :func:" +"`tiltangle` has been enhanced in functionality: it now can be used to get or " +"set the tilt angle." msgstr "" -#: ../../library/turtle.rst:2868 +#: ../../library/turtle.rst:2898 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: ../../library/turtle.rst:2872 +#: ../../library/turtle.rst:2902 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: ../../library/turtle.rst:2876 +#: ../../library/turtle.rst:2906 msgid "" -"Two input methods have been added: :func:`Screen.textinput ` " -"and :func:`Screen.numinput `. These pop up input dialogs and " -"return strings and numbers respectively." +"Two input methods have been added: :func:`Screen.textinput ` and :" +"func:`Screen.numinput `. These pop up input dialogs and return " +"strings and numbers respectively." msgstr "" #~ msgid ":func:`settiltangle`" diff --git a/library/typing.po b/library/typing.po index 1bd99ff57d..849f70b547 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-21 00:14+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-" @@ -390,7 +390,7 @@ msgstr "" "class:`str`。" #: ../../library/typing.rst:215 ../../library/typing.rst:3288 -#: ../../library/typing.rst:3473 +#: ../../library/typing.rst:3474 msgid "For example:" msgstr "舉例來說:" @@ -513,7 +513,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:287 ../../library/typing.rst:3990 +#: ../../library/typing.rst:287 ../../library/typing.rst:4005 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -668,9 +668,9 @@ msgid "" "``tuple`` as an annotation is equivalent to using ``tuple[Any, ...]``::" msgstr "" "為了標示一個元組可以為\\ *任意*\\ 長度,且所有元素皆是相同型別 ``T``,請使用 " -"刪節號字面值 (literal ellipsis) ``...``:``tuple[T, ...]``。為了標示" -"一個空元組,請使用 ``tuple[()]``。單純使用 ``tuple`` 作為註釋會與使用 ``tuple[Any, ...]`` " -"相等: ::" +"刪節號字面值 (literal ellipsis) ``...``:``tuple[T, ...]``。為了標示一個空元" +"組,請使用 ``tuple[()]``。單純使用 ``tuple`` 作為註釋會與使用 " +"``tuple[Any, ...]`` 相等: ::" #: ../../library/typing.rst:388 msgid "" @@ -1581,7 +1581,7 @@ msgstr "" #: ../../library/typing.rst:1048 ../../library/typing.rst:1230 #: ../../library/typing.rst:1317 ../../library/typing.rst:1359 #: ../../library/typing.rst:1568 ../../library/typing.rst:1629 -#: ../../library/typing.rst:3225 ../../library/typing.rst:3458 +#: ../../library/typing.rst:3225 ../../library/typing.rst:3459 msgid "For example::" msgstr "舉例來說: ::" @@ -2404,10 +2404,10 @@ msgstr "" msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " -"``x``. In this way, ``Annotated`` differs from the :func:`@no_type_check " -"` decorator, which can also be used for adding annotations " -"outside the scope of the typing system, but completely disables typechecking " -"for a function or class." +"``x``. In this way, ``Annotated`` differs from the :deco:`no_type_check` " +"decorator, which can also be used for adding annotations outside the scope " +"of the typing system, but completely disables typechecking for a function or " +"class." msgstr "" #: ../../library/typing.rst:1397 @@ -3670,7 +3670,7 @@ msgstr "" "'Alias'" #: ../../library/typing.rst:2272 -msgid "The module in which the type alias was defined::" +msgid "The name of the module in which the type alias was defined::" msgstr "" #: ../../library/typing.rst:2274 @@ -3761,6 +3761,18 @@ msgid "" ">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" "ForwardRef('undefined')" msgstr "" +">>> type Alias = undefined\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> from annotationlib import Format, call_evaluate_function\n" +">>> Alias.evaluate_value(Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')" #: ../../library/typing.rst:2337 msgid "Unpacking" @@ -3779,6 +3791,10 @@ msgid "" ">>> Unpacked.__value__\n" "tuple[bool, typing.Unpack[Alias]]" msgstr "" +">>> type Alias = tuple[int, str]\n" +">>> type Unpacked = tuple[bool, *Alias]\n" +">>> Unpacked.__value__\n" +"tuple[bool, typing.Unpack[Alias]]" #: ../../library/typing.rst:2352 msgid "Other special directives" @@ -3796,7 +3812,7 @@ msgid "Typed version of :func:`collections.namedtuple`." msgstr "" #: ../../library/typing.rst:2362 ../../library/typing.rst:2458 -#: ../../library/typing.rst:3562 +#: ../../library/typing.rst:3563 msgid "Usage::" msgstr "用法: ::" @@ -3965,7 +3981,7 @@ msgid "" msgstr "" #: ../../library/typing.rst:2465 -msgid "The module in which the new type is defined." +msgid "The name of the module in which the new type is defined." msgstr "" #: ../../library/typing.rst:2469 @@ -4559,7 +4575,7 @@ msgstr "協定" #: ../../library/typing.rst:2837 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " -"decorated with :func:`@runtime_checkable `." +"decorated with :deco:`runtime_checkable`." msgstr "" #: ../../library/typing.rst:2842 @@ -4809,7 +4825,7 @@ msgid "" "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 in a similar way " -"to :func:`@dataclasses.dataclass `." +"to :deco:`dataclasses.dataclass`." msgstr "" #: ../../library/typing.rst:3021 @@ -4885,19 +4901,19 @@ msgstr "" #: ../../library/typing.rst:3055 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :deco:`dataclasses.dataclass`. For " +"example, type checkers will assume these classes have ``__init__`` methods " +"that accept ``id`` and ``name``." msgstr "" #: ../../library/typing.rst:3061 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " -"have on the :func:`@dataclasses.dataclass` decorator: " -"``init``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, " -"``kw_only``, and ``slots``. It must be possible for the value of these " -"arguments (``True`` or ``False``) to be statically evaluated." +"have on the :deco:`dataclasses.dataclass` decorator: ``init``, ``eq``, " +"``order``, ``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, and " +"``slots``. It must be possible for the value of these arguments (``True`` or " +"``False``) to be statically evaluated." msgstr "" #: ../../library/typing.rst:3069 @@ -5111,19 +5127,17 @@ msgid "" msgstr "" #: ../../library/typing.rst:3192 -msgid "" -"Return a sequence of :func:`@overload `-decorated definitions for " -"*func*." +msgid "Return a sequence of :deco:`overload`-decorated definitions for *func*." msgstr "" #: ../../library/typing.rst:3195 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " -"documentation for :func:`@overload `, ``get_overloads(process)`` " -"will return a sequence of three function objects for the three defined " -"overloads. If called on a function with no overloads, ``get_overloads()`` " -"returns an empty sequence." +"documentation for :deco:`overload`, ``get_overloads(process)`` will return a " +"sequence of three function objects for the three defined overloads. If " +"called on a function with no overloads, ``get_overloads()`` returns an empty " +"sequence." msgstr "" #: ../../library/typing.rst:3202 @@ -5328,8 +5342,8 @@ msgstr "" #: ../../library/typing.rst:3354 msgid "" -"If :func:`@no_type_check ` has been applied to *obj*, an " -"empty dictionary is returned." +"If :deco:`no_type_check` has been applied to *obj*, an empty dictionary is " +"returned." msgstr "" #: ../../library/typing.rst:3356 @@ -5344,24 +5358,25 @@ msgstr "" #: ../../library/typing.rst:3363 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)." +"The function recursively replaces all occurrences of ``Annotated[T, ...]``, " +"``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]`` with ``T``, unless " +"*include_extras* is set to ``True`` (see :class:`Annotated` for more " +"information)." msgstr "" -#: ../../library/typing.rst:3367 +#: ../../library/typing.rst:3368 msgid "" "See also :func:`annotationlib.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3372 ../../library/typing.rst:3523 +#: ../../library/typing.rst:3373 ../../library/typing.rst:3524 msgid "" "This function may execute arbitrary code contained in annotations. See :ref:" "`annotationlib-security` for more information." msgstr "" -#: ../../library/typing.rst:3377 +#: ../../library/typing.rst:3378 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 :" @@ -5370,7 +5385,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3383 +#: ../../library/typing.rst:3384 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -5378,20 +5393,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3387 +#: ../../library/typing.rst:3388 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:3394 +#: ../../library/typing.rst:3395 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3397 +#: ../../library/typing.rst:3398 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 :" @@ -5399,11 +5414,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3403 ../../library/typing.rst:3427 +#: ../../library/typing.rst:3404 ../../library/typing.rst:3428 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3406 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5421,13 +5436,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3419 +#: ../../library/typing.rst:3420 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:3422 +#: ../../library/typing.rst:3423 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 " @@ -5435,7 +5450,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3429 +#: ../../library/typing.rst:3430 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5445,11 +5460,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3439 +#: ../../library/typing.rst:3440 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3441 +#: ../../library/typing.rst:3442 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5465,15 +5480,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3451 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3456 +#: ../../library/typing.rst:3457 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3460 +#: ../../library/typing.rst:3461 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5489,11 +5504,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3472 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3475 +#: ../../library/typing.rst:3476 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5507,57 +5522,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3493 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:3495 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3500 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:3505 +#: ../../library/typing.rst:3506 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3512 +#: ../../library/typing.rst:3513 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3514 +#: ../../library/typing.rst:3515 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3519 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3531 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3533 +#: ../../library/typing.rst:3534 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5573,17 +5588,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3545 +#: ../../library/typing.rst:3546 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3549 +#: ../../library/typing.rst:3550 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3552 +#: ../../library/typing.rst:3553 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5595,7 +5610,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3564 +#: ../../library/typing.rst:3565 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5609,7 +5624,7 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3570 +#: ../../library/typing.rst:3571 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5618,11 +5633,11 @@ msgid "" "raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:3584 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3586 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5631,7 +5646,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3593 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 " @@ -5639,7 +5654,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3597 +#: ../../library/typing.rst:3598 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 " @@ -5647,38 +5662,38 @@ msgid "" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3602 +#: ../../library/typing.rst:3603 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:3608 +#: ../../library/typing.rst:3609 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3613 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3615 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:3618 +#: ../../library/typing.rst:3619 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3625 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3626 +#: ../../library/typing.rst:3627 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5686,136 +5701,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3631 +#: ../../library/typing.rst:3632 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3638 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3639 +#: ../../library/typing.rst:3640 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:3643 +#: ../../library/typing.rst:3644 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3649 +#: ../../library/typing.rst:3650 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3652 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3659 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3661 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3663 +#: ../../library/typing.rst:3664 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3669 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3671 +#: ../../library/typing.rst:3672 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3676 +#: ../../library/typing.rst:3677 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3683 +#: ../../library/typing.rst:3684 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3688 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3691 +#: ../../library/typing.rst:3692 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3697 +#: ../../library/typing.rst:3698 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3701 +#: ../../library/typing.rst:3702 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3707 +#: ../../library/typing.rst:3708 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3711 +#: ../../library/typing.rst:3712 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3717 +#: ../../library/typing.rst:3718 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3721 +#: ../../library/typing.rst:3722 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3727 +#: ../../library/typing.rst:3728 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3731 +#: ../../library/typing.rst:3732 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3739 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3743 +#: ../../library/typing.rst:3744 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3746 +#: ../../library/typing.rst:3747 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5823,29 +5838,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3751 +#: ../../library/typing.rst:3752 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3757 +#: ../../library/typing.rst:3758 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3759 +#: ../../library/typing.rst:3760 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:3763 +#: ../../library/typing.rst:3764 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:3766 +#: ../../library/typing.rst:3767 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5853,315 +5868,339 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3771 +#: ../../library/typing.rst:3772 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:3781 +#: ../../library/typing.rst:3782 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3785 +#: ../../library/typing.rst:3786 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3787 +#: ../../library/typing.rst:3788 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3793 -msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." -msgstr "" +#: ../../library/typing.rst:3794 +msgid "Deprecated alias to :class:`collections.abc.ByteString`." +msgstr "棄用 :class:`collections.abc.ByteString` 的別名。" #: ../../library/typing.rst:3796 msgid "" -"Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " -"| memoryview``." -msgstr "" - -#: ../../library/typing.rst:3801 +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../library/typing.rst:3802 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../library/typing.rst:3810 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." +msgstr "更多細節請見 :pep:`PEP 688 <688#current-options>`。" + +#: ../../library/typing.rst:3816 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3805 +#: ../../library/typing.rst:3820 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3811 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3813 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3819 +#: ../../library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3836 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3827 +#: ../../library/typing.rst:3842 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3829 +#: ../../library/typing.rst:3844 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3835 +#: ../../library/typing.rst:3850 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3837 +#: ../../library/typing.rst:3852 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3843 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3845 +#: ../../library/typing.rst:3860 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3851 +#: ../../library/typing.rst:3866 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3853 +#: ../../library/typing.rst:3868 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3875 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3877 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3869 +#: ../../library/typing.rst:3884 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3871 +#: ../../library/typing.rst:3886 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3877 +#: ../../library/typing.rst:3892 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3894 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3900 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3887 +#: ../../library/typing.rst:3902 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3909 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3913 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3915 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:3906 +#: ../../library/typing.rst:3921 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3927 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3929 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:3920 +#: ../../library/typing.rst:3935 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3925 +#: ../../library/typing.rst:3940 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3930 +#: ../../library/typing.rst:3945 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3934 +#: ../../library/typing.rst:3949 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3940 +#: ../../library/typing.rst:3955 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3944 +#: ../../library/typing.rst:3959 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3950 +#: ../../library/typing.rst:3965 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3954 +#: ../../library/typing.rst:3969 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3961 +#: ../../library/typing.rst:3976 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3965 +#: ../../library/typing.rst:3980 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3967 +#: ../../library/typing.rst:3982 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3973 +#: ../../library/typing.rst:3988 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3975 +#: ../../library/typing.rst:3990 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3981 +#: ../../library/typing.rst:3996 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3983 +#: ../../library/typing.rst:3998 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:3986 +#: ../../library/typing.rst:4001 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4011 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3998 +#: ../../library/typing.rst:4013 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:4002 +#: ../../library/typing.rst:4017 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4006 +#: ../../library/typing.rst:4021 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:4011 +#: ../../library/typing.rst:4026 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:4013 +#: ../../library/typing.rst:4028 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4018 +#: ../../library/typing.rst:4033 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4020 +#: ../../library/typing.rst:4035 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4026 +#: ../../library/typing.rst:4041 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4028 +#: ../../library/typing.rst:4043 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4034 +#: ../../library/typing.rst:4049 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4038 +#: ../../library/typing.rst:4053 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4040 +#: ../../library/typing.rst:4055 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -6169,21 +6208,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4047 +#: ../../library/typing.rst:4062 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4052 +#: ../../library/typing.rst:4067 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4057 +#: ../../library/typing.rst:4072 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4059 +#: ../../library/typing.rst:4074 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6191,21 +6230,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4066 +#: ../../library/typing.rst:4081 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4071 +#: ../../library/typing.rst:4086 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4090 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4077 +#: ../../library/typing.rst:4092 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6213,119 +6252,119 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4084 +#: ../../library/typing.rst:4099 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4085 +#: ../../library/typing.rst:4100 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4086 +#: ../../library/typing.rst:4101 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4087 +#: ../../library/typing.rst:4102 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4088 +#: ../../library/typing.rst:4103 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4089 ../../library/typing.rst:4093 +#: ../../library/typing.rst:4104 ../../library/typing.rst:4108 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4090 +#: ../../library/typing.rst:4105 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4091 +#: ../../library/typing.rst:4106 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4092 +#: ../../library/typing.rst:4107 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:4094 +#: ../../library/typing.rst:4109 msgid "3.17" -msgstr "" +msgstr "3.17" -#: ../../library/typing.rst:4095 +#: ../../library/typing.rst:4110 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:4096 +#: ../../library/typing.rst:4111 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4097 +#: ../../library/typing.rst:4112 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4098 ../../library/typing.rst:4102 -#: ../../library/typing.rst:4106 +#: ../../library/typing.rst:4113 ../../library/typing.rst:4117 +#: ../../library/typing.rst:4121 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4099 +#: ../../library/typing.rst:4114 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4100 +#: ../../library/typing.rst:4115 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4101 ../../library/typing.rst:4105 +#: ../../library/typing.rst:4116 ../../library/typing.rst:4120 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4103 +#: ../../library/typing.rst:4118 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4104 +#: ../../library/typing.rst:4119 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4107 +#: ../../library/typing.rst:4122 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4108 +#: ../../library/typing.rst:4123 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4109 ../../library/typing.rst:4113 +#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4110 +#: ../../library/typing.rst:4125 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4111 +#: ../../library/typing.rst:4126 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4112 +#: ../../library/typing.rst:4127 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4114 +#: ../../library/typing.rst:4129 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4115 +#: ../../library/typing.rst:4130 msgid ":gh:`105578`" msgstr ":gh:`105578`" #: ../../library/typing.rst:233 ../../library/typing.rst:380 #: ../../library/typing.rst:1170 msgid "..." -msgstr "" +msgstr "..." #: ../../library/typing.rst:233 ../../library/typing.rst:380 #: ../../library/typing.rst:1170 diff --git a/library/unicodedata.po b/library/unicodedata.po index f4adfb8c54..f8691eb1e9 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-17 00:13+0000\n" +"POT-Creation-Date: 2025-09-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -157,6 +157,8 @@ msgid "" ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" "'Lu'" msgstr "" +">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +"'Lu'" #: ../../library/unicodedata.rst:111 msgid "" @@ -178,9 +180,9 @@ msgstr "" msgid "" "Returns the canonical combining class assigned to the character *chr* as " "integer. Returns ``0`` if no combining class is defined. See the `Canonical " -"Combining Class Values section of the Unicode Character Database `_ " -"for more information." +"Combining Class Values section of the Unicode Character Database `_ for more information." msgstr "" #: ../../library/unicodedata.rst:132 diff --git a/library/urllib.parse.po b/library/urllib.parse.po index caab72679e..a40a8c363b 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -1035,7 +1035,7 @@ msgstr "" #: ../../library/urllib.parse.rst:772 msgid ":rfc:`3986` - Uniform Resource Identifiers" -msgstr "" +msgstr ":rfc:`3986` - 統一資源識別碼" #: ../../library/urllib.parse.rst:773 msgid "" @@ -1055,7 +1055,7 @@ msgstr "" #: ../../library/urllib.parse.rst:781 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" -msgstr "" +msgstr ":rfc:`2396` - 統一資源識別碼 (URI):通用語法" #: ../../library/urllib.parse.rst:782 msgid "" diff --git a/library/urllib.request.po b/library/urllib.request.po index c421bfa7b4..7f794ed457 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -1562,6 +1562,14 @@ msgid "" "lt-ie8 lt-ie9\"> \\n\\n\\n