From 052c2fcfd9c0103473fc6b9377a0cba478581f6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 20 Apr 2026 00:28:08 +0000 Subject: [PATCH 1/4] sync with cpython f283ac45 --- library/multiprocessing.po | 18 +++++++++--------- using/android.po | 21 ++++++++++----------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/library/multiprocessing.po b/library/multiprocessing.po index e3093d27ac2..9e6e6c9c30d 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-13 00:26+0000\n" +"POT-Creation-Date: 2026-04-20 00:26+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2005,8 +2005,8 @@ msgstr "" #: ../../library/multiprocessing.rst:1333 msgid "" -"If *offset* is given then data is read from that position in *buffer*. If " -"*size* is given then that many bytes will be read from buffer. Very large " +"If *offset* is given then data is read from that position in *buf*. If " +"*size* is given then that many bytes will be read from *buf*. Very large " "buffers (approximately 32 MiB+, though it depends on the OS) may raise a :" "exc:`ValueError` exception" msgstr "" @@ -2033,17 +2033,17 @@ msgstr "" #: ../../library/multiprocessing.rst:1356 msgid "" -"Read into *buffer* a complete message of byte data sent from the other end " -"of the connection and return the number of bytes in the message. Blocks " -"until there is something to receive. Raises :exc:`EOFError` if there is " -"nothing left to receive and the other end was closed." +"Read into *buf* a complete message of byte data sent from the other end of " +"the connection and return the number of bytes in the message. Blocks until " +"there is something to receive. Raises :exc:`EOFError` if there is nothing " +"left to receive and the other end was closed." msgstr "" #: ../../library/multiprocessing.rst:1362 msgid "" -"*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " +"*buf* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " -"must be a non-negative integer less than the length of *buffer* (in bytes)." +"must be a non-negative integer less than the length of *buf* (in bytes)." msgstr "" #: ../../library/multiprocessing.rst:1367 diff --git a/using/android.po b/using/android.po index 029b282b09b..36daa748943 100644 --- a/using/android.po +++ b/using/android.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-19 00:15+0000\n" +"POT-Creation-Date: 2026-04-20 00:26+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-" @@ -29,10 +29,9 @@ msgid "" "running a :program:`python` executable and entering commands at an " "interactive prompt, or by running a Python script." msgstr "" -"Android 上的 Python 與桌面版的 Python 不同。在桌面版上,Python 通常作為系統" -"資源安裝,供該台電腦上的任何使用者使用。使用者通常透過執行 :program:`python` " -"可執行檔並在互動式提示字元中輸入指令,或是直接執行 Python 腳本與 Python 互" -"動。" +"Android 上的 Python 與桌面版的 Python 不同。在桌面版上,Python 通常作為系統資" +"源安裝,供該台電腦上的任何使用者使用。使用者通常透過執行 :program:`python` 可" +"執行檔並在互動式提示字元中輸入指令,或是直接執行 Python 腳本與 Python 互動。" #: ../../using/android.rst:13 msgid "" @@ -53,10 +52,10 @@ msgid "" "for its own private use." msgstr "" "因此,在 Android 上使用 Python 的唯一方式就是以嵌入模式運作 - 也就是撰寫一個" -"原生的 Android 應用程式,使用 ``libpython`` 嵌入 Python 直譯器,並透" -"過 :ref:`Python 嵌入式 API ` 呼叫 Python 程式碼。完整的 Python " -"直譯器、標準函式庫,以及你所有的 Python 程式碼,都會被打包進你的應用程式,供" -"該應用程式使用。" +"原生的 Android 應用程式,使用 ``libpython`` 嵌入 Python 直譯器,並透過 :ref:" +"`Python 嵌入式 API ` 呼叫 Python 程式碼。完整的 Python 直譯器、標" +"準函式庫,以及你所有的 Python 程式碼,都會被打包進你的應用程式,供該應用程式" +"使用。" #: ../../using/android.rst:23 msgid "" @@ -80,8 +79,8 @@ msgstr "" "驗:" #: ../../using/android.rst:33 -msgid "" -"`Briefcase `__, from the BeeWare project" +#, fuzzy +msgid "`Briefcase `__, from the BeeWare project" msgstr "`Briefcase `__,由 BeeWare 專案提供" #: ../../using/android.rst:34 From 871d2f063cdf7234c3439b80995726df50cd2418 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 21 Apr 2026 00:29:36 +0000 Subject: [PATCH 2/4] sync with cpython c235654c --- library/calendar.po | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/library/calendar.po b/library/calendar.po index 8f2769095b8..564e2ad64bc 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-04-21 00:28+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-" @@ -99,7 +99,7 @@ msgstr "" #: ../../library/calendar.rst:59 msgid "" -"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)." msgstr "" #: ../../library/calendar.rst:61 @@ -107,8 +107,9 @@ msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." msgstr "" #: ../../library/calendar.rst:65 +#, fuzzy msgid "" -"Return an iterator for the week day numbers that will be used for one week. " +"Return an iterator for the weekday numbers that will be used for one week. " "The first value from the iterator will be the same as the value of the :attr:" "`~Calendar.firstweekday` property." msgstr "" @@ -137,11 +138,12 @@ msgstr "" "之外的日期數字會是 ``0``。" #: ../../library/calendar.rst:88 +#, fuzzy msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " "Days returned will be tuples consisting of a day of the month number and a " -"week day number." +"weekday number." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由該月當日的數字及代表週" @@ -540,8 +542,9 @@ msgid "" msgstr "回傳包含一週每一天的名稱縮寫的標題。*n* 指定每一天的字元寬度。" #: ../../library/calendar.rst:408 +#, fuzzy msgid "" -"Returns weekday of first day of the month and number of days in month, for " +"Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "回傳指定 *year* 年 *month* 月該月第一天代表週幾的數字及該月有多少天。" @@ -580,11 +583,12 @@ msgstr "" "`~TextCalendar.formatyear`。" #: ../../library/calendar.rst:443 +#, fuzzy msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " "corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX " -"encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each others' " +"encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's " "inverse." msgstr "" "一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡的 :func:`~time." From db9cb8ec07c188a88a8015d23ec18d4ebd79ea85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Apr 2026 00:31:52 +0000 Subject: [PATCH 3/4] sync with cpython 5b334241 --- c-api/allocation.po | 37 ++-- c-api/file.po | 20 +- c-api/frame.po | 40 ++-- c-api/long.po | 337 +++++++++++++++--------------- c-api/module.po | 59 +++--- c-api/monitoring.po | 6 +- c-api/sequence.po | 63 +++--- library/os.po | 498 ++++++++++++++++++++++---------------------- sphinx.po | 16 +- 9 files changed, 531 insertions(+), 545 deletions(-) diff --git a/c-api/allocation.po b/c-api/allocation.po index 616ca9afcfc..e1754c8847f 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-09 17:02+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,8 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" #: ../../c-api/allocation.rst:6 -msgid "Allocating Objects on the Heap" +#, fuzzy +msgid "Allocating objects on the heap" msgstr "在 heap 上分配物件" #: ../../c-api/allocation.rst:17 @@ -132,8 +133,8 @@ msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" #: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 -#: ../../c-api/allocation.rst:182 ../../c-api/allocation.rst:184 -#: ../../c-api/allocation.rst:186 +#: ../../c-api/allocation.rst:184 ../../c-api/allocation.rst:186 +#: ../../c-api/allocation.rst:188 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" @@ -214,43 +215,45 @@ msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" #: ../../c-api/allocation.rst:157 -msgid "Deprecated aliases" +#, fuzzy +msgid "Soft-deprecated aliases" msgstr "被棄用的別名" -#: ../../c-api/allocation.rst:159 +#: ../../c-api/allocation.rst:161 msgid "" -"These are :term:`soft deprecated` aliases to existing functions and macros. " -"They exist solely for backwards compatibility." +"These are aliases to existing functions and macros. They exist solely for " +"backwards compatibility." msgstr "" -#: ../../c-api/allocation.rst:167 -msgid "Deprecated alias" +#: ../../c-api/allocation.rst:169 +#, fuzzy +msgid "Soft-deprecated alias" msgstr "已棄用的別名" -#: ../../c-api/allocation.rst:168 +#: ../../c-api/allocation.rst:170 msgid "Function" msgstr "函式" -#: ../../c-api/allocation.rst:170 +#: ../../c-api/allocation.rst:172 msgid ":c:macro:`PyObject_New`" msgstr ":c:macro:`PyObject_New`" -#: ../../c-api/allocation.rst:172 +#: ../../c-api/allocation.rst:174 msgid ":c:macro:`PyObject_NewVar`" msgstr ":c:macro:`PyObject_NewVar`" -#: ../../c-api/allocation.rst:174 +#: ../../c-api/allocation.rst:176 msgid ":c:func:`PyObject_Init`" msgstr ":c:func:`PyObject_Init`" -#: ../../c-api/allocation.rst:176 +#: ../../c-api/allocation.rst:178 msgid ":c:func:`PyObject_InitVar`" msgstr ":c:func:`PyObject_InitVar`" -#: ../../c-api/allocation.rst:178 +#: ../../c-api/allocation.rst:180 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" -#: ../../c-api/allocation.rst:180 +#: ../../c-api/allocation.rst:182 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" diff --git a/c-api/file.po b/c-api/file.po index 63a9922c85d..6dd76dec215 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-23 00:22+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2023-04-24 20:38+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,8 @@ msgstr "" "X-Generator: Poedit 3.2.2\n" #: ../../c-api/file.rst:6 -msgid "File Objects" +#, fuzzy +msgid "File objects" msgstr "檔案物件 (File Objects)" #: ../../c-api/file.rst:10 @@ -219,19 +220,20 @@ msgstr "" "的例外狀況。" #: ../../c-api/file.rst:140 -msgid "Deprecated API" +#, fuzzy +msgid "Soft-deprecated API" msgstr "已棄用的 API" -#: ../../c-api/file.rst:143 +#: ../../c-api/file.rst:144 +#, fuzzy msgid "" -"These are :term:`soft deprecated` APIs that were included in Python's C API " -"by mistake. They are documented solely for completeness; use other " -"``PyFile*`` APIs instead." +"These are APIs that were included in Python's C API by mistake. They are " +"documented solely for completeness; use other ``PyFile*`` APIs instead." msgstr "" "這些是被錯誤地包含在 Python C API 中的\\ :term:`軟性棄用 ` " "API。它們僅為了完整性而記錄於文件中;請改用其他 ``PyFile*`` API。" -#: ../../c-api/file.rst:149 +#: ../../c-api/file.rst:150 msgid "" "Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, \"w\", -1, NULL, " "NULL, NULL, 0``) instead." @@ -239,7 +241,7 @@ msgstr "" "請改用帶有預設值 (``fd, NULL, \"w\", -1, NULL, NULL, NULL, 0``) 的 :c:func:" "`PyFile_FromFd`。" -#: ../../c-api/file.rst:153 +#: ../../c-api/file.rst:154 msgid "" "Type of file-like objects used internally at Python startup when :py:mod:" "`io` is not yet available. Use Python :py:func:`open` or :c:func:" diff --git a/c-api/frame.po b/c-api/frame.po index 1d376aec5cb..a4fcef3acf2 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-28 00:16+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../c-api/frame.rst:4 -msgid "Frame Objects" +#, fuzzy +msgid "Frame objects" msgstr "Frame 物件" #: ../../c-api/frame.rst:8 @@ -173,7 +174,7 @@ msgid "Return the line number that *frame* is currently executing." msgstr "" #: ../../c-api/frame.rst:151 -msgid "Frame Locals Proxies" +msgid "Frame locals proxies" msgstr "" #: ../../c-api/frame.rst:155 @@ -198,7 +199,7 @@ msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." msgstr "" #: ../../c-api/frame.rst:173 -msgid "Legacy Local Variable APIs" +msgid "Legacy local variable APIs" msgstr "" #: ../../c-api/frame.rst:175 @@ -207,12 +208,7 @@ msgid "" "They exist solely for backwards compatibility." msgstr "" -#: ../../c-api/frame.rst:181 ../../c-api/frame.rst:195 -#: ../../c-api/frame.rst:208 -msgid "This function is :term:`soft deprecated` and does nothing." -msgstr "" - -#: ../../c-api/frame.rst:183 +#: ../../c-api/frame.rst:181 msgid "" "Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` " "attribute of *f* to the internal \"fast\" array of local variables, allowing " @@ -221,12 +217,12 @@ msgid "" "dictionary." msgstr "" -#: ../../c-api/frame.rst:189 ../../c-api/frame.rst:202 -#: ../../c-api/frame.rst:214 +#: ../../c-api/frame.rst:187 ../../c-api/frame.rst:198 +#: ../../c-api/frame.rst:208 msgid "This function now does nothing." msgstr "" -#: ../../c-api/frame.rst:197 +#: ../../c-api/frame.rst:193 msgid "" "Prior to Python 3.13, this function would copy the internal \"fast\" array " "of local variables (which is used by the interpreter) to the :attr:`~frame." @@ -234,38 +230,38 @@ msgid "" "visible to frame objects." msgstr "" -#: ../../c-api/frame.rst:210 +#: ../../c-api/frame.rst:204 msgid "" "Prior to Python 3.13, this function was similar to :c:func:" "`PyFrame_FastToLocals`, but would return ``0`` on success, and ``-1`` with " "an exception set on failure." msgstr "" -#: ../../c-api/frame.rst:219 +#: ../../c-api/frame.rst:213 msgid ":pep:`667`" msgstr ":pep:`667`" -#: ../../c-api/frame.rst:223 -msgid "Internal Frames" +#: ../../c-api/frame.rst:217 +msgid "Internal frames" msgstr "" -#: ../../c-api/frame.rst:225 +#: ../../c-api/frame.rst:219 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:229 +#: ../../c-api/frame.rst:223 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:235 +#: ../../c-api/frame.rst:229 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:242 +#: ../../c-api/frame.rst:236 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:249 +#: ../../c-api/frame.rst:243 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 36f31a05654..9e87f061939 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-16 00:15+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -189,7 +189,7 @@ msgid "" "`PyLong_FromLongLong`, depending on the size of the system's PID type." msgstr "" -#: ../../c-api/long.rst:181 ../../c-api/long.rst:217 +#: ../../c-api/long.rst:181 ../../c-api/long.rst:215 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " @@ -202,39 +202,34 @@ msgid "" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:188 ../../c-api/long.rst:226 ../../c-api/long.rst:247 -#: ../../c-api/long.rst:267 ../../c-api/long.rst:290 +#: ../../c-api/long.rst:188 ../../c-api/long.rst:224 ../../c-api/long.rst:245 +#: ../../c-api/long.rst:265 ../../c-api/long.rst:288 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:190 ../../c-api/long.rst:228 ../../c-api/long.rst:249 -#: ../../c-api/long.rst:271 ../../c-api/long.rst:355 ../../c-api/long.rst:375 +#: ../../c-api/long.rst:190 ../../c-api/long.rst:226 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:269 ../../c-api/long.rst:353 ../../c-api/long.rst:373 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:193 ../../c-api/long.rst:231 ../../c-api/long.rst:252 -#: ../../c-api/long.rst:274 ../../c-api/long.rst:358 ../../c-api/long.rst:378 +#: ../../c-api/long.rst:193 ../../c-api/long.rst:229 ../../c-api/long.rst:250 +#: ../../c-api/long.rst:272 ../../c-api/long.rst:356 ../../c-api/long.rst:376 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" #: ../../c-api/long.rst:200 msgid "" -"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " -"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " -"another exception." +"Exactly equivalent to the preferred ``PyLong_AsLong``. In particular, it can " +"fail with :exc:`OverflowError` or another exception." msgstr "" -#: ../../c-api/long.rst:204 -msgid "The function is soft deprecated." -msgstr "" - -#: ../../c-api/long.rst:209 +#: ../../c-api/long.rst:207 msgid "" "Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" "`int` instead of a C :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:221 +#: ../../c-api/long.rst:219 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -242,20 +237,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:240 ../../c-api/long.rst:258 +#: ../../c-api/long.rst:238 ../../c-api/long.rst:256 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:244 +#: ../../c-api/long.rst:242 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:262 +#: ../../c-api/long.rst:260 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -263,170 +258,170 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:284 +#: ../../c-api/long.rst:282 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:287 +#: ../../c-api/long.rst:285 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:299 +#: ../../c-api/long.rst:297 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:302 +#: ../../c-api/long.rst:300 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:305 +#: ../../c-api/long.rst:303 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:315 +#: ../../c-api/long.rst:313 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:318 +#: ../../c-api/long.rst:316 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:321 +#: ../../c-api/long.rst:319 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:330 +#: ../../c-api/long.rst:328 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:333 +#: ../../c-api/long.rst:331 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" "c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:336 +#: ../../c-api/long.rst:334 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:339 +#: ../../c-api/long.rst:337 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:345 +#: ../../c-api/long.rst:343 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:349 +#: ../../c-api/long.rst:347 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:352 +#: ../../c-api/long.rst:350 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:364 +#: ../../c-api/long.rst:362 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:369 +#: ../../c-api/long.rst:367 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:372 +#: ../../c-api/long.rst:370 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:385 +#: ../../c-api/long.rst:383 msgid "" "Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:388 ../../c-api/long.rst:408 +#: ../../c-api/long.rst:386 ../../c-api/long.rst:406 msgid "" "If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:" "`~object.__index__` method (if present) to convert it to a :c:type:" "`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:392 ../../c-api/long.rst:413 +#: ../../c-api/long.rst:390 ../../c-api/long.rst:411 msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." msgstr "" -#: ../../c-api/long.rst:394 ../../c-api/long.rst:415 +#: ../../c-api/long.rst:392 ../../c-api/long.rst:413 msgid "" "Set *\\*value* and return ``0`` on success. Set an exception and return " "``-1`` on error." msgstr "" -#: ../../c-api/long.rst:397 ../../c-api/long.rst:418 +#: ../../c-api/long.rst:395 ../../c-api/long.rst:416 msgid "*value* must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:405 +#: ../../c-api/long.rst:403 msgid "" "Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:412 +#: ../../c-api/long.rst:410 msgid "If *obj* is negative, raise a :exc:`ValueError`." msgstr "" -#: ../../c-api/long.rst:425 +#: ../../c-api/long.rst:423 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:428 +#: ../../c-api/long.rst:426 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:431 +#: ../../c-api/long.rst:429 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:436 +#: ../../c-api/long.rst:434 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " @@ -434,26 +429,26 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:441 +#: ../../c-api/long.rst:439 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:446 +#: ../../c-api/long.rst:444 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" -#: ../../c-api/long.rst:450 +#: ../../c-api/long.rst:448 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -#: ../../c-api/long.rst:454 +#: ../../c-api/long.rst:452 msgid "" "Otherwise, returns the number of bytes required to store the value. If this " "is equal to or less than *n_bytes*, the entire value was copied. All " @@ -461,7 +456,7 @@ msgid "" "sign bit." msgstr "" -#: ../../c-api/long.rst:459 +#: ../../c-api/long.rst:457 msgid "" "If the returned value is greater than *n_bytes*, the value was truncated: as " "many of the lowest bits of the value as could fit are written, and the " @@ -469,25 +464,25 @@ msgid "" "downcast." msgstr "" -#: ../../c-api/long.rst:466 +#: ../../c-api/long.rst:464 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" -#: ../../c-api/long.rst:469 +#: ../../c-api/long.rst:467 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:471 +#: ../../c-api/long.rst:469 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:473 +#: ../../c-api/long.rst:471 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:475 +#: ../../c-api/long.rst:473 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -504,26 +499,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:489 +#: ../../c-api/long.rst:487 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -#: ../../c-api/long.rst:496 +#: ../../c-api/long.rst:494 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" -#: ../../c-api/long.rst:499 +#: ../../c-api/long.rst:497 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" -#: ../../c-api/long.rst:502 +#: ../../c-api/long.rst:500 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -554,69 +549,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:530 +#: ../../c-api/long.rst:528 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:535 +#: ../../c-api/long.rst:533 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:541 +#: ../../c-api/long.rst:539 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:541 +#: ../../c-api/long.rst:539 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:543 +#: ../../c-api/long.rst:541 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:544 +#: ../../c-api/long.rst:542 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:545 +#: ../../c-api/long.rst:543 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:546 +#: ../../c-api/long.rst:544 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:547 +#: ../../c-api/long.rst:545 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:548 +#: ../../c-api/long.rst:546 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:549 +#: ../../c-api/long.rst:547 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:552 +#: ../../c-api/long.rst:550 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:555 +#: ../../c-api/long.rst:553 msgid "" "By default, sufficient buffer will be requested to include a sign bit. For " "example, when converting 128 with *n_bytes=1*, the function will return 2 " "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:559 +#: ../../c-api/long.rst:557 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -626,7 +621,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:566 +#: ../../c-api/long.rst:564 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -634,7 +629,7 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:571 +#: ../../c-api/long.rst:569 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " @@ -644,7 +639,7 @@ msgid "" "`TypeError`." msgstr "" -#: ../../c-api/long.rst:580 +#: ../../c-api/long.rst:578 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -652,88 +647,88 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:591 +#: ../../c-api/long.rst:589 msgid "Macro for converting a Python integer into a process identifier." msgstr "" -#: ../../c-api/long.rst:593 +#: ../../c-api/long.rst:591 msgid "" "This can be defined as an alias to :c:func:`PyLong_AsLong`, :c:func:" "`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the size of " "the system's PID type." msgstr "" -#: ../../c-api/long.rst:602 +#: ../../c-api/long.rst:600 msgid "Get the sign of the integer object *obj*." msgstr "" -#: ../../c-api/long.rst:604 +#: ../../c-api/long.rst:602 msgid "" "On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " "negative or positive integer, respectively) and return 0." msgstr "" -#: ../../c-api/long.rst:607 +#: ../../c-api/long.rst:605 msgid "" "On failure, return -1 with an exception set. This function always succeeds " "if *obj* is a :c:type:`PyLongObject` or its subtype." msgstr "" -#: ../../c-api/long.rst:615 +#: ../../c-api/long.rst:613 msgid "Check if the integer object *obj* is positive (``obj > 0``)." msgstr "檢查整數物件 *obj* 是否為正(``obj > 0``)。" -#: ../../c-api/long.rst:617 +#: ../../c-api/long.rst:615 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's positive and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為正數時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為正數時回傳 " +"``1``,否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:626 +#: ../../c-api/long.rst:624 msgid "Check if the integer object *obj* is negative (``obj < 0``)." msgstr "檢查整數物件 *obj* 是否為負(``obj < 0``)。" -#: ../../c-api/long.rst:628 +#: ../../c-api/long.rst:626 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's negative and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為負數時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為負數時回傳 " +"``1``,否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:637 +#: ../../c-api/long.rst:635 msgid "Check if the integer object *obj* is zero." msgstr "檢查整數物件 *obj* 是否為零。" -#: ../../c-api/long.rst:639 +#: ../../c-api/long.rst:637 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's zero and ``0`` otherwise. Else set an exception and return " "``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為零時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為零時回傳 ``1``," +"否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:648 +#: ../../c-api/long.rst:646 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:652 +#: ../../c-api/long.rst:650 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:659 +#: ../../c-api/long.rst:657 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:661 +#: ../../c-api/long.rst:659 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" @@ -741,93 +736,93 @@ msgid "" "`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:667 +#: ../../c-api/long.rst:665 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:669 +#: ../../c-api/long.rst:667 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:677 +#: ../../c-api/long.rst:675 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:680 +#: ../../c-api/long.rst:678 msgid "Otherwise, the return value is undefined." msgstr "" -#: ../../c-api/long.rst:686 +#: ../../c-api/long.rst:684 msgid "Export API" msgstr "匯出 API" -#: ../../c-api/long.rst:692 +#: ../../c-api/long.rst:690 msgid "" "Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " "represent absolute value for arbitrary precision integers." msgstr "" -#: ../../c-api/long.rst:695 +#: ../../c-api/long.rst:693 msgid "" "Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :" "class:`int` objects, used internally for integers with \"big enough\" " "absolute value." msgstr "" -#: ../../c-api/long.rst:699 +#: ../../c-api/long.rst:697 msgid "" "See also :data:`sys.int_info` which exposes similar information in Python." msgstr "" -#: ../../c-api/long.rst:703 +#: ../../c-api/long.rst:701 msgid "" "Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " "meaningful information." msgstr "" -#: ../../c-api/long.rst:708 +#: ../../c-api/long.rst:706 msgid "" "Digit size in bytes. For example, a 15 bit digit will require at least 2 " "bytes." msgstr "" -#: ../../c-api/long.rst:713 +#: ../../c-api/long.rst:711 msgid "Digits order:" msgstr "" -#: ../../c-api/long.rst:715 +#: ../../c-api/long.rst:713 msgid "``1`` for most significant digit first" msgstr "" -#: ../../c-api/long.rst:716 +#: ../../c-api/long.rst:714 msgid "``-1`` for least significant digit first" msgstr "" -#: ../../c-api/long.rst:720 +#: ../../c-api/long.rst:718 msgid "Digit endianness:" msgstr "" -#: ../../c-api/long.rst:722 +#: ../../c-api/long.rst:720 msgid "``1`` for most significant byte first (big endian)" msgstr "" -#: ../../c-api/long.rst:723 +#: ../../c-api/long.rst:721 msgid "``-1`` for least significant byte first (little endian)" msgstr "" -#: ../../c-api/long.rst:728 +#: ../../c-api/long.rst:726 msgid "Get the native layout of Python :class:`int` objects." msgstr "" -#: ../../c-api/long.rst:730 +#: ../../c-api/long.rst:728 msgid "See the :c:struct:`PyLongLayout` structure." msgstr "請見 :c:struct:`PyLongLayout` 結構。" -#: ../../c-api/long.rst:732 +#: ../../c-api/long.rst:730 msgid "" "The function must not be called before Python initialization nor after " "Python finalization. The returned layout is valid until Python is finalized. " @@ -835,128 +830,128 @@ msgid "" "it can be cached." msgstr "" -#: ../../c-api/long.rst:740 +#: ../../c-api/long.rst:738 msgid "Export of a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:742 +#: ../../c-api/long.rst:740 msgid "There are two cases:" msgstr "" -#: ../../c-api/long.rst:744 +#: ../../c-api/long.rst:742 msgid "" "If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." msgstr "" -#: ../../c-api/long.rst:745 +#: ../../c-api/long.rst:743 msgid "" "If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:" "`ndigits` and :c:member:`digits` members." msgstr "" -#: ../../c-api/long.rst:750 +#: ../../c-api/long.rst:748 msgid "" "The native integer value of the exported :class:`int` object. Only valid if :" "c:member:`digits` is ``NULL``." msgstr "" -#: ../../c-api/long.rst:755 +#: ../../c-api/long.rst:753 msgid "" "``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:760 +#: ../../c-api/long.rst:758 msgid "" "Number of digits in :c:member:`digits` array. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:765 +#: ../../c-api/long.rst:763 msgid "Read-only array of unsigned digits. Can be ``NULL``." msgstr "" -#: ../../c-api/long.rst:770 +#: ../../c-api/long.rst:768 msgid "Export a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:772 +#: ../../c-api/long.rst:770 msgid "" "*export_long* must point to a :c:struct:`PyLongExport` structure allocated " "by the caller. It must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:775 +#: ../../c-api/long.rst:773 msgid "" "On success, fill in *\\*export_long* and return ``0``. On error, set an " "exception and return ``-1``." msgstr "" -#: ../../c-api/long.rst:778 +#: ../../c-api/long.rst:776 msgid "" ":c:func:`PyLong_FreeExport` must be called when the export is no longer " "needed." msgstr "" -#: ../../c-api/long.rst:782 +#: ../../c-api/long.rst:780 msgid "" "This function always succeeds if *obj* is a Python :class:`int` object or a " "subclass." msgstr "" -#: ../../c-api/long.rst:788 +#: ../../c-api/long.rst:786 msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/long.rst:791 +#: ../../c-api/long.rst:789 msgid "" "Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " "``NULL``." msgstr "" -#: ../../c-api/long.rst:796 +#: ../../c-api/long.rst:794 msgid "PyLongWriter API" msgstr "PyLongWriter API" -#: ../../c-api/long.rst:798 +#: ../../c-api/long.rst:796 msgid "The :c:type:`PyLongWriter` API can be used to import an integer." msgstr "" -#: ../../c-api/long.rst:804 +#: ../../c-api/long.rst:802 msgid "A Python :class:`int` writer instance." msgstr "" -#: ../../c-api/long.rst:806 +#: ../../c-api/long.rst:804 msgid "" "The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:" "`PyLongWriter_Discard`." msgstr "" -#: ../../c-api/long.rst:812 +#: ../../c-api/long.rst:810 msgid "Create a :c:type:`PyLongWriter`." msgstr "建立一個 :c:type:`PyLongWriter`。" -#: ../../c-api/long.rst:814 +#: ../../c-api/long.rst:812 msgid "" "On success, allocate *\\*digits* and return a writer. On error, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:817 +#: ../../c-api/long.rst:815 msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." msgstr "" -#: ../../c-api/long.rst:819 +#: ../../c-api/long.rst:817 msgid "" "*ndigits* is the number of digits in the *digits* array. It must be greater " "than 0." msgstr "" -#: ../../c-api/long.rst:822 +#: ../../c-api/long.rst:820 msgid "*digits* must not be NULL." msgstr "*digits* 不得為 NULL。" -#: ../../c-api/long.rst:824 +#: ../../c-api/long.rst:822 msgid "" "After a successful call to this function, the caller should fill in the " "array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " @@ -964,83 +959,85 @@ msgid "" "`PyLong_GetNativeLayout`." msgstr "" -#: ../../c-api/long.rst:829 +#: ../../c-api/long.rst:827 msgid "" "Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " "the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " "digit). Any unused most significant digits must be set to ``0``." msgstr "" -#: ../../c-api/long.rst:834 +#: ../../c-api/long.rst:832 msgid "" "Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " "instance without creating an :class:`~int` object." msgstr "" -#: ../../c-api/long.rst:840 +#: ../../c-api/long.rst:838 msgid "" "Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" -#: ../../c-api/long.rst:842 +#: ../../c-api/long.rst:840 msgid "" "On success, return a Python :class:`int` object. On error, set an exception " "and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:845 +#: ../../c-api/long.rst:843 msgid "" "The function takes care of normalizing the digits and converts the object to " "a compact integer if needed." msgstr "" -#: ../../c-api/long.rst:848 ../../c-api/long.rst:857 +#: ../../c-api/long.rst:846 ../../c-api/long.rst:855 msgid "The writer instance and the *digits* array are invalid after the call." msgstr "" -#: ../../c-api/long.rst:853 +#: ../../c-api/long.rst:851 msgid "" "Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "丟棄由 :c:func:`PyLongWriter_Create` 建立的 :c:type:`PyLongWriter`。" -#: ../../c-api/long.rst:855 +#: ../../c-api/long.rst:853 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "如果 *writer* 為 ``NULL``,則不執行任何操作。" -#: ../../c-api/long.rst:861 +#: ../../c-api/long.rst:859 msgid "Deprecated API" msgstr "已棄用的 API" -#: ../../c-api/long.rst:863 +#: ../../c-api/long.rst:861 msgid "" "These macros are :term:`soft deprecated`. They describe parameters of the " "internal representation of :c:type:`PyLongObject` instances." msgstr "" -"這些巨集已被\\ :term:`軟性棄用 `。它們描述了 :c:type:`PyLongObject` " -"實例的內部表示參數。" +"這些巨集已被\\ :term:`軟性棄用 `。它們描述了 :c:type:" +"`PyLongObject` 實例的內部表示參數。" -#: ../../c-api/long.rst:866 +#: ../../c-api/long.rst:864 msgid "" "Use :c:func:`PyLong_GetNativeLayout` instead, along with :c:func:" "`PyLong_Export` to read integer data or :c:type:`PyLongWriter` to write it. " "These currently use the same layout, but are designed to continue working " "correctly even if CPython's internal integer representation changes." msgstr "" -"請改用 :c:func:`PyLong_GetNativeLayout`,並與 :c:func:`PyLong_Export` 使用來讀取整數資料," -"或者 :c:type:`PyLongWriter` 來寫入它們。它們目前使用相同的佈局,不過即使 CPython 的內部整數表" -"示發生變化,也能繼續正確運作。" +"請改用 :c:func:`PyLong_GetNativeLayout`,並與 :c:func:`PyLong_Export` 使用來" +"讀取整數資料,或者 :c:type:`PyLongWriter` 來寫入它們。它們目前使用相同的佈" +"局,不過即使 CPython 的內部整數表示發生變化,也能繼續正確運作。" -#: ../../c-api/long.rst:874 +#: ../../c-api/long.rst:872 msgid "" "This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in the output " "of :c:func:`PyLong_GetNativeLayout`." -msgstr "這等同於 :c:func:`PyLong_GetNativeLayout` 輸出中的 :c:member:`~PyLongLayout.bits_per_digit`。" +msgstr "" +"這等同於 :c:func:`PyLong_GetNativeLayout` 輸出中的 :c:member:`~PyLongLayout." +"bits_per_digit`。" -#: ../../c-api/long.rst:880 +#: ../../c-api/long.rst:878 msgid "This is currently equivalent to :c:expr:`1 << PyLong_SHIFT`." msgstr "這目前等同於 :c:expr:`1 << PyLong_SHIFT`。" -#: ../../c-api/long.rst:885 +#: ../../c-api/long.rst:883 msgid "This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`" msgstr "這目前等同於 :c:expr:`(1 << PyLong_SHIFT) - 1`" @@ -1060,19 +1057,19 @@ msgstr "integer(整數)" msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:177 ../../c-api/long.rst:237 ../../c-api/long.rst:280 -#: ../../c-api/long.rst:295 ../../c-api/long.rst:311 ../../c-api/long.rst:327 +#: ../../c-api/long.rst:177 ../../c-api/long.rst:235 ../../c-api/long.rst:278 +#: ../../c-api/long.rst:293 ../../c-api/long.rst:309 ../../c-api/long.rst:325 msgid "OverflowError (built-in exception)" msgstr "OverflowError(內建例外)" -#: ../../c-api/long.rst:280 +#: ../../c-api/long.rst:278 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:295 +#: ../../c-api/long.rst:293 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:311 +#: ../../c-api/long.rst:309 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/module.po b/c-api/module.po index 17aee4df655..b6fbb54bf03 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: 2026-02-24 00:20+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -703,25 +703,20 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:609 -msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." -msgstr "" -":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" - -#: ../../c-api/module.rst:614 +#: ../../c-api/module.rst:612 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:618 +#: ../../c-api/module.rst:616 msgid "" "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:624 +#: ../../c-api/module.rst:622 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 " @@ -729,14 +724,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:629 +#: ../../c-api/module.rst:627 msgid "" "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:636 +#: ../../c-api/module.rst:634 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 " @@ -744,11 +739,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:644 +#: ../../c-api/module.rst:642 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:648 +#: ../../c-api/module.rst:646 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 " @@ -756,7 +751,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:658 +#: ../../c-api/module.rst:656 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -765,7 +760,7 @@ msgid "" "first parameter, making them similar to instance methods on Python classes)." msgstr "" -#: ../../c-api/module.rst:664 +#: ../../c-api/module.rst:662 msgid "" "This function is called automatically when creating a module from " "``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " @@ -774,13 +769,13 @@ msgid "" "that case they should call this function directly." msgstr "" -#: ../../c-api/module.rst:671 +#: ../../c-api/module.rst:669 msgid "" "The *functions* array must be statically allocated (or otherwise guaranteed " "to outlive the module object)." msgstr "" -#: ../../c-api/module.rst:678 +#: ../../c-api/module.rst:676 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef`` (such as when " @@ -788,11 +783,11 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:683 +#: ../../c-api/module.rst:681 msgid "Return ``0`` on success. Return ``-1`` with an exception set on error." msgstr "成功時回傳 ``0``。在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:690 +#: ../../c-api/module.rst:688 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`. " @@ -804,11 +799,11 @@ msgid "" "on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:704 +#: ../../c-api/module.rst:702 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:706 +#: ../../c-api/module.rst:704 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -816,14 +811,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:711 +#: ../../c-api/module.rst:709 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:716 +#: ../../c-api/module.rst:714 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -832,18 +827,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:723 +#: ../../c-api/module.rst:721 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`." msgstr "" -#: ../../c-api/module.rst:726 +#: ../../c-api/module.rst:724 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:728 +#: ../../c-api/module.rst:726 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -855,21 +850,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:737 +#: ../../c-api/module.rst:735 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:740 ../../c-api/module.rst:751 +#: ../../c-api/module.rst:738 ../../c-api/module.rst:749 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:742 +#: ../../c-api/module.rst:740 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:748 +#: ../../c-api/module.rst:746 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -914,3 +909,7 @@ msgstr "__dict__(模組屬性)" #: ../../c-api/module.rst:80 ../../c-api/module.rst:119 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" + +#~ msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." +#~ msgstr "" +#~ ":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 8c2bc0c80c4..3cdc4026b15 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-05 00:16+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -296,7 +296,3 @@ msgid "" "Return true if the event corresponding to the event ID *ev* is a :ref:`local " "event `." msgstr "" - -#: ../../c-api/monitoring.rst:210 -msgid "This function is :term:`soft deprecated`." -msgstr "" diff --git a/c-api/sequence.po b/c-api/sequence.po index 912fea56bfa..57f91522de8 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.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: 2026-04-23 00:30+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-" @@ -24,10 +24,10 @@ msgstr "序列協定" #: ../../c-api/sequence.rst:11 msgid "" "Return ``1`` if the object provides the sequence protocol, and ``0`` " -"otherwise. Note that it returns ``1`` for Python classes with " -"a :meth:`~object.__getitem__` method, unless they are :class:`dict` " -"subclasses, since in general it is impossible to determine what type of keys " -"the class supports. This function always succeeds." +"otherwise. Note that it returns ``1`` for Python classes with a :meth:" +"`~object.__getitem__` method, unless they are :class:`dict` subclasses, " +"since in general it is impossible to determine what type of keys the class " +"supports. This function always succeeds." msgstr "" #: ../../c-api/sequence.rst:23 @@ -126,25 +126,23 @@ msgid "Alias for :c:func:`PySequence_Contains`." msgstr ":c:func:`PySequence_Contains` 的別名。" #: ../../c-api/sequence.rst:112 -msgid "" -"The function is :term:`soft deprecated` and should no longer be used to " -"write new code." +msgid "The function should no longer be used to write new code." msgstr "" -#: ../../c-api/sequence.rst:119 +#: ../../c-api/sequence.rst:118 msgid "" "Return the first index *i* for which ``o[i] == value``. On error, return " "``-1``. This is equivalent to the Python expression ``o.index(value)``." msgstr "" -#: ../../c-api/sequence.rst:125 +#: ../../c-api/sequence.rst:124 msgid "" "Return a list object with the same contents as the sequence or iterable *o*, " "or ``NULL`` on failure. The returned list is guaranteed to be new. This is " "equivalent to the Python expression ``list(o)``." msgstr "" -#: ../../c-api/sequence.rst:134 +#: ../../c-api/sequence.rst:133 msgid "" "Return a tuple object with the same contents as the sequence or iterable " "*o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be " @@ -152,7 +150,7 @@ msgid "" "contents. This is equivalent to the Python expression ``tuple(o)``." msgstr "" -#: ../../c-api/sequence.rst:142 +#: ../../c-api/sequence.rst:141 msgid "" "Return the sequence or iterable *o* as an object usable by the other " "``PySequence_Fast*`` family of functions. If the object is not a sequence or " @@ -160,57 +158,56 @@ msgid "" "``NULL`` on failure." msgstr "" -#: ../../c-api/sequence.rst:147 +#: ../../c-api/sequence.rst:146 msgid "" "The ``PySequence_Fast*`` functions are thus named because they assume *o* is " "a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data " "fields of *o* directly." msgstr "" -#: ../../c-api/sequence.rst:151 +#: ../../c-api/sequence.rst:150 msgid "" "As a CPython implementation detail, if *o* is already a sequence or list, it " "will be returned." msgstr "" -#: ../../c-api/sequence.rst:157 +#: ../../c-api/sequence.rst:156 msgid "" -"Returns the length of *o*, assuming that *o* was returned " -"by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can " -"also be retrieved by calling :c:func:`PySequence_Size` on *o*, " -"but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* " -"is a list or tuple." +"Returns the length of *o*, assuming that *o* was returned by :c:func:" +"`PySequence_Fast` and that *o* is not ``NULL``. The size can also be " +"retrieved by calling :c:func:`PySequence_Size` on *o*, but :c:func:" +"`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or " +"tuple." msgstr "" -#: ../../c-api/sequence.rst:166 +#: ../../c-api/sequence.rst:165 msgid "" -"Return the *i*\\ th element of *o*, assuming that *o* was returned " -"by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within " -"bounds." +"Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:" +"func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." msgstr "" -#: ../../c-api/sequence.rst:172 +#: ../../c-api/sequence.rst:171 msgid "" "Return the underlying array of PyObject pointers. Assumes that *o* was " "returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -#: ../../c-api/sequence.rst:175 +#: ../../c-api/sequence.rst:174 msgid "" "Note, if a list gets resized, the reallocation may relocate the items array. " "So, only use the underlying array pointer in contexts where the sequence " "cannot change." msgstr "" -#: ../../c-api/sequence.rst:182 +#: ../../c-api/sequence.rst:181 msgid "" -"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form " -"of :c:func:`PySequence_GetItem` but without checking " -"that :c:func:`PySequence_Check` on *o* is true and without adjustment for " -"negative indices." +"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:" +"func:`PySequence_GetItem` but without checking that :c:func:" +"`PySequence_Check` on *o* is true and without adjustment for negative " +"indices." msgstr "" -#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:132 +#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:131 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -218,6 +215,6 @@ msgstr "built-in function(內建函式)" msgid "len" msgstr "len" -#: ../../c-api/sequence.rst:132 +#: ../../c-api/sequence.rst:131 msgid "tuple" msgstr "tuple(元組)" diff --git a/library/os.po b/library/os.po index a8ac1c1a11c..f4679a29f9e 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: 2026-03-12 00:16+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -377,25 +377,25 @@ msgstr "" #: ../../library/os.rst:4635 ../../library/os.rst:4642 #: ../../library/os.rst:4653 ../../library/os.rst:4663 #: ../../library/os.rst:4672 ../../library/os.rst:4704 -#: ../../library/os.rst:4816 ../../library/os.rst:4832 -#: ../../library/os.rst:4865 ../../library/os.rst:4934 -#: ../../library/os.rst:4957 ../../library/os.rst:4968 -#: ../../library/os.rst:4980 ../../library/os.rst:5025 -#: ../../library/os.rst:5062 ../../library/os.rst:5085 -#: ../../library/os.rst:5106 ../../library/os.rst:5140 -#: ../../library/os.rst:5181 ../../library/os.rst:5201 -#: ../../library/os.rst:5215 ../../library/os.rst:5232 -#: ../../library/os.rst:5247 ../../library/os.rst:5258 -#: ../../library/os.rst:5270 ../../library/os.rst:5283 -#: ../../library/os.rst:5292 ../../library/os.rst:5302 -#: ../../library/os.rst:5315 ../../library/os.rst:5350 -#: ../../library/os.rst:5366 ../../library/os.rst:5377 -#: ../../library/os.rst:5389 ../../library/os.rst:5396 -#: ../../library/os.rst:5405 ../../library/os.rst:5414 -#: ../../library/os.rst:5423 ../../library/os.rst:5432 -#: ../../library/os.rst:5596 ../../library/os.rst:5605 -#: ../../library/os.rst:5629 ../../library/os.rst:5656 -#: ../../library/os.rst:5665 ../../library/os.rst:5788 +#: ../../library/os.rst:4815 ../../library/os.rst:4831 +#: ../../library/os.rst:4864 ../../library/os.rst:4933 +#: ../../library/os.rst:4955 ../../library/os.rst:4966 +#: ../../library/os.rst:4978 ../../library/os.rst:5023 +#: ../../library/os.rst:5060 ../../library/os.rst:5083 +#: ../../library/os.rst:5104 ../../library/os.rst:5138 +#: ../../library/os.rst:5179 ../../library/os.rst:5199 +#: ../../library/os.rst:5213 ../../library/os.rst:5230 +#: ../../library/os.rst:5245 ../../library/os.rst:5256 +#: ../../library/os.rst:5268 ../../library/os.rst:5281 +#: ../../library/os.rst:5290 ../../library/os.rst:5300 +#: ../../library/os.rst:5313 ../../library/os.rst:5348 +#: ../../library/os.rst:5364 ../../library/os.rst:5375 +#: ../../library/os.rst:5387 ../../library/os.rst:5394 +#: ../../library/os.rst:5403 ../../library/os.rst:5412 +#: ../../library/os.rst:5421 ../../library/os.rst:5430 +#: ../../library/os.rst:5594 ../../library/os.rst:5603 +#: ../../library/os.rst:5627 ../../library/os.rst:5654 +#: ../../library/os.rst:5663 ../../library/os.rst:5786 msgid "Availability" msgstr "可用性" @@ -964,7 +964,7 @@ msgid "" "on iOS and Android." msgstr "" -#: ../../library/os.rst:819 ../../library/os.rst:5087 +#: ../../library/os.rst:819 ../../library/os.rst:5085 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." @@ -1530,7 +1530,7 @@ msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" #: ../../library/os.rst:1306 ../../library/os.rst:1657 -#: ../../library/os.rst:1892 ../../library/os.rst:5183 +#: ../../library/os.rst:1892 ../../library/os.rst:5181 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 :" @@ -1551,7 +1551,7 @@ msgstr "" #: ../../library/os.rst:3594 ../../library/os.rst:3634 #: ../../library/os.rst:3734 ../../library/os.rst:3795 #: ../../library/os.rst:4192 ../../library/os.rst:4372 -#: ../../library/os.rst:4941 +#: ../../library/os.rst:4940 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -5306,36 +5306,34 @@ msgid "" "encodings." msgstr "" -#: ../../library/os.rst:4714 -msgid "" -"The function is :term:`soft deprecated` and should no longer be used to " -"write new code. The :mod:`subprocess` module is recommended instead." +#: ../../library/os.rst:4714 ../../library/os.rst:4943 +msgid "The :mod:`subprocess` module is recommended instead." msgstr "" -#: ../../library/os.rst:4723 +#: ../../library/os.rst:4722 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4725 +#: ../../library/os.rst:4724 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4727 +#: ../../library/os.rst:4726 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`. *env* is allowed to be ``None``, in which case current process' " "environment is used." msgstr "" -#: ../../library/os.rst:4731 +#: ../../library/os.rst:4730 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4735 +#: ../../library/os.rst:4734 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5344,39 +5342,39 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4743 +#: ../../library/os.rst:4742 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4745 +#: ../../library/os.rst:4744 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4749 +#: ../../library/os.rst:4748 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4751 +#: ../../library/os.rst:4750 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4755 +#: ../../library/os.rst:4754 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4757 +#: ../../library/os.rst:4756 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4761 +#: ../../library/os.rst:4760 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4763 +#: ../../library/os.rst:4762 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4765 +#: ../../library/os.rst:4764 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" @@ -5386,7 +5384,7 @@ msgid "" "c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4772 +#: ../../library/os.rst:4771 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5395,7 +5393,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4778 +#: ../../library/os.rst:4777 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5406,7 +5404,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4786 +#: ../../library/os.rst:4785 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5414,7 +5412,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4791 +#: ../../library/os.rst:4790 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5422,14 +5420,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4796 +#: ../../library/os.rst:4795 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4800 +#: ../../library/os.rst:4799 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5439,7 +5437,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4807 ../../library/os.rst:4828 +#: ../../library/os.rst:4806 ../../library/os.rst:4827 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5447,79 +5445,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4811 +#: ../../library/os.rst:4810 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4822 +#: ../../library/os.rst:4821 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4824 +#: ../../library/os.rst:4823 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4834 +#: ../../library/os.rst:4833 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4840 +#: ../../library/os.rst:4839 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4845 +#: ../../library/os.rst:4844 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4846 +#: ../../library/os.rst:4845 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4848 +#: ../../library/os.rst:4847 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4850 +#: ../../library/os.rst:4849 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4854 +#: ../../library/os.rst:4853 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4859 +#: ../../library/os.rst:4858 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4863 +#: ../../library/os.rst:4862 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4879 +#: ../../library/os.rst:4878 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4881 +#: ../../library/os.rst:4880 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5527,7 +5525,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4886 +#: ../../library/os.rst:4885 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5536,13 +5534,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4892 +#: ../../library/os.rst:4891 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4895 +#: ../../library/os.rst:4894 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5554,7 +5552,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4904 +#: ../../library/os.rst:4903 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5567,7 +5565,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4914 +#: ../../library/os.rst:4913 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5579,13 +5577,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4923 +#: ../../library/os.rst:4922 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4926 +#: ../../library/os.rst:4925 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5599,7 +5597,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4932 +#: ../../library/os.rst:4931 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5607,7 +5605,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4936 +#: ../../library/os.rst:4935 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5615,13 +5613,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4944 -msgid "" -"These functions are :term:`soft deprecated` and should no longer be used to " -"write new code. The :mod:`subprocess` module is recommended instead." -msgstr "" - -#: ../../library/os.rst:4952 +#: ../../library/os.rst:4950 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5629,7 +5621,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4962 +#: ../../library/os.rst:4960 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5638,7 +5630,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4974 +#: ../../library/os.rst:4972 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5648,11 +5640,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:4983 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:4985 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5660,7 +5652,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4992 +#: ../../library/os.rst:4990 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5668,28 +5660,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4997 +#: ../../library/os.rst:4995 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:5001 +#: ../../library/os.rst:4999 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:5005 +#: ../../library/os.rst:5003 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:5009 +#: ../../library/os.rst:5007 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5700,14 +5692,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:5017 +#: ../../library/os.rst:5015 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:5021 +#: ../../library/os.rst:5019 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5715,7 +5707,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:5023 +#: ../../library/os.rst:5021 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5723,13 +5715,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:5027 +#: ../../library/os.rst:5025 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:5034 +#: ../../library/os.rst:5032 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5740,13 +5732,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:5042 +#: ../../library/os.rst:5040 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5043 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5755,7 +5747,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:5051 +#: ../../library/os.rst:5049 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is recommended " @@ -5763,54 +5755,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:5056 +#: ../../library/os.rst:5054 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:5060 +#: ../../library/os.rst:5058 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:5067 +#: ../../library/os.rst:5065 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:5070 +#: ../../library/os.rst:5068 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:5071 +#: ../../library/os.rst:5069 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:5072 +#: ../../library/os.rst:5070 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:5073 +#: ../../library/os.rst:5071 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:5074 +#: ../../library/os.rst:5072 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:5076 +#: ../../library/os.rst:5074 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:5080 +#: ../../library/os.rst:5078 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5820,7 +5812,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:5094 +#: ../../library/os.rst:5092 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5829,87 +5821,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5100 +#: ../../library/os.rst:5098 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5103 ../../library/os.rst:5178 +#: ../../library/os.rst:5101 ../../library/os.rst:5176 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5110 +#: ../../library/os.rst:5108 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5117 +#: ../../library/os.rst:5115 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5119 +#: ../../library/os.rst:5117 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5122 +#: ../../library/os.rst:5120 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5126 +#: ../../library/os.rst:5124 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5129 +#: ../../library/os.rst:5127 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5130 +#: ../../library/os.rst:5128 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5131 +#: ../../library/os.rst:5129 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5132 +#: ../../library/os.rst:5130 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5133 +#: ../../library/os.rst:5131 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5135 +#: ../../library/os.rst:5133 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5144 +#: ../../library/os.rst:5142 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5150 +#: ../../library/os.rst:5148 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5152 +#: ../../library/os.rst:5150 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5918,7 +5910,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5155 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5928,7 +5920,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5164 +#: ../../library/os.rst:5162 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5937,7 +5929,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5170 +#: ../../library/os.rst:5168 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5949,7 +5941,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:5191 +#: ../../library/os.rst:5189 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5958,13 +5950,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5198 ../../library/os.rst:5212 +#: ../../library/os.rst:5196 ../../library/os.rst:5210 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5206 +#: ../../library/os.rst:5204 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5973,118 +5965,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5223 +#: ../../library/os.rst:5221 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5226 +#: ../../library/os.rst:5224 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5227 +#: ../../library/os.rst:5225 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5228 +#: ../../library/os.rst:5226 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5229 +#: ../../library/os.rst:5227 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5234 +#: ../../library/os.rst:5232 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5237 +#: ../../library/os.rst:5235 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5243 +#: ../../library/os.rst:5241 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5252 +#: ../../library/os.rst:5250 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5255 +#: ../../library/os.rst:5253 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5265 +#: ../../library/os.rst:5263 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5268 ../../library/os.rst:5300 +#: ../../library/os.rst:5266 ../../library/os.rst:5298 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5277 +#: ../../library/os.rst:5275 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5281 +#: ../../library/os.rst:5279 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5288 +#: ../../library/os.rst:5286 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5295 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5312 +#: ../../library/os.rst:5310 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5319 +#: ../../library/os.rst:5317 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "新增 :data:`CLD_KILLED` 和 :data:`CLD_STOPPED` 值。" -#: ../../library/os.rst:5325 +#: ../../library/os.rst:5323 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5327 +#: ../../library/os.rst:5325 msgid "On Unix:" msgstr "在 Unix 上:" -#: ../../library/os.rst:5329 +#: ../../library/os.rst:5327 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5332 +#: ../../library/os.rst:5330 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -6092,15 +6084,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5336 +#: ../../library/os.rst:5334 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "否則,引發 :exc:`ValueError`。" -#: ../../library/os.rst:5338 +#: ../../library/os.rst:5336 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5340 +#: ../../library/os.rst:5338 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -6108,234 +6100,234 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5347 +#: ../../library/os.rst:5345 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:5355 +#: ../../library/os.rst:5353 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5361 +#: ../../library/os.rst:5359 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5364 ../../library/os.rst:5430 +#: ../../library/os.rst:5362 ../../library/os.rst:5428 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5371 +#: ../../library/os.rst:5369 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5375 +#: ../../library/os.rst:5373 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5382 +#: ../../library/os.rst:5380 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5385 +#: ../../library/os.rst:5383 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5393 +#: ../../library/os.rst:5391 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5401 +#: ../../library/os.rst:5399 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5408 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5412 +#: ../../library/os.rst:5410 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5419 +#: ../../library/os.rst:5417 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5421 +#: ../../library/os.rst:5419 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5428 +#: ../../library/os.rst:5426 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5436 +#: ../../library/os.rst:5434 msgid "Interface to the scheduler" msgstr "排程器介面" -#: ../../library/os.rst:5438 +#: ../../library/os.rst:5436 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5444 +#: ../../library/os.rst:5442 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5451 +#: ../../library/os.rst:5449 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5455 +#: ../../library/os.rst:5453 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5460 +#: ../../library/os.rst:5458 msgid "Scheduling policy for tasks with deadline constraints." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5464 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5470 +#: ../../library/os.rst:5468 msgid "Alias for :data:`SCHED_OTHER`." msgstr ":data:`SCHED_OTHER` 的別名。" -#: ../../library/os.rst:5476 +#: ../../library/os.rst:5474 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5480 +#: ../../library/os.rst:5478 msgid "A First In First Out scheduling policy." msgstr "先進先出排程策略。" -#: ../../library/os.rst:5484 +#: ../../library/os.rst:5482 msgid "A round-robin scheduling policy." msgstr "輪轉排程策略。" -#: ../../library/os.rst:5488 +#: ../../library/os.rst:5486 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5495 +#: ../../library/os.rst:5493 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5499 +#: ../../library/os.rst:5497 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5503 +#: ../../library/os.rst:5501 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5508 +#: ../../library/os.rst:5506 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5514 +#: ../../library/os.rst:5512 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5520 +#: ../../library/os.rst:5518 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5527 +#: ../../library/os.rst:5525 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5534 +#: ../../library/os.rst:5532 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5540 +#: ../../library/os.rst:5538 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5546 +#: ../../library/os.rst:5544 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5552 +#: ../../library/os.rst:5550 msgid "" "Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5557 +#: ../../library/os.rst:5555 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5564 +#: ../../library/os.rst:5562 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5566 +#: ../../library/os.rst:5564 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5569 +#: ../../library/os.rst:5567 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5575 +#: ../../library/os.rst:5573 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5580 +#: ../../library/os.rst:5578 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6346,13 +6338,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5588 +#: ../../library/os.rst:5586 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5591 +#: ../../library/os.rst:5589 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -6360,62 +6352,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5601 +#: ../../library/os.rst:5599 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5610 +#: ../../library/os.rst:5608 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5613 +#: ../../library/os.rst:5611 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5618 +#: ../../library/os.rst:5616 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the override value *n*." msgstr "" -#: ../../library/os.rst:5625 +#: ../../library/os.rst:5623 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5634 +#: ../../library/os.rst:5632 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " "process**. Returns ``None`` if undetermined. It can be less than :func:" "`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5638 +#: ../../library/os.rst:5636 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5641 +#: ../../library/os.rst:5639 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the override value *n*." msgstr "" -#: ../../library/os.rst:5644 +#: ../../library/os.rst:5642 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5651 +#: ../../library/os.rst:5649 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6424,44 +6416,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5661 +#: ../../library/os.rst:5659 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5667 +#: ../../library/os.rst:5665 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "新增 ``'SC_MINSIGSTKSZ'`` 名稱。" -#: ../../library/os.rst:5670 +#: ../../library/os.rst:5668 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5673 +#: ../../library/os.rst:5671 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5679 +#: ../../library/os.rst:5677 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5687 +#: ../../library/os.rst:5685 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5694 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6470,7 +6462,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5706 +#: ../../library/os.rst:5704 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6478,27 +6470,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5715 +#: ../../library/os.rst:5713 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5723 +#: ../../library/os.rst:5721 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5730 +#: ../../library/os.rst:5728 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5737 +#: ../../library/os.rst:5735 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6507,36 +6499,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5746 +#: ../../library/os.rst:5744 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5757 +#: ../../library/os.rst:5755 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5765 +#: ../../library/os.rst:5763 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5770 +#: ../../library/os.rst:5768 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5773 +#: ../../library/os.rst:5771 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5776 +#: ../../library/os.rst:5774 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6544,32 +6536,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5781 +#: ../../library/os.rst:5779 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5785 +#: ../../library/os.rst:5783 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5794 +#: ../../library/os.rst:5792 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5796 +#: ../../library/os.rst:5794 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5800 +#: ../../library/os.rst:5798 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6579,63 +6571,63 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5807 +#: ../../library/os.rst:5805 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5811 +#: ../../library/os.rst:5809 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5814 +#: ../../library/os.rst:5812 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5818 +#: ../../library/os.rst:5816 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5824 +#: ../../library/os.rst:5822 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5828 +#: ../../library/os.rst:5826 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5832 +#: ../../library/os.rst:5830 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5838 +#: ../../library/os.rst:5836 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5842 +#: ../../library/os.rst:5840 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5849 +#: ../../library/os.rst:5847 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." @@ -6745,40 +6737,40 @@ msgstr "" msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5676 ../../library/os.rst:5712 +#: ../../library/os.rst:5674 ../../library/os.rst:5710 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5676 ../../library/os.rst:5684 -#: ../../library/os.rst:5692 ../../library/os.rst:5703 -#: ../../library/os.rst:5712 +#: ../../library/os.rst:5674 ../../library/os.rst:5682 +#: ../../library/os.rst:5690 ../../library/os.rst:5701 +#: ../../library/os.rst:5710 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5684 +#: ../../library/os.rst:5682 msgid ".." msgstr ".." -#: ../../library/os.rst:5692 ../../library/os.rst:5703 +#: ../../library/os.rst:5690 ../../library/os.rst:5701 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5693 +#: ../../library/os.rst:5691 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5693 +#: ../../library/os.rst:5691 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/sphinx.po b/sphinx.po index 388ff999d69..41c4f9ed6d8 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-19 00:20+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -241,23 +241,27 @@ msgstr "自從版本 %s 後不推薦使用,將會自版本 %s 中移除。" msgid "Deprecated since version %s, removed in version %s" msgstr "自從版本 %s 後不推薦使用,已從版本 %s 中移除。" -#: ../../tools/templates/dummy.html:35 +#: ../../tools/templates/dummy.html:32 +msgid ":term:`Soft deprecated` since version %s" +msgstr "" + +#: ../../tools/templates/dummy.html:36 msgid "in development" msgstr "開發中" -#: ../../tools/templates/dummy.html:36 +#: ../../tools/templates/dummy.html:37 msgid "pre-release" msgstr "預發行" -#: ../../tools/templates/dummy.html:37 +#: ../../tools/templates/dummy.html:38 msgid "stable" msgstr "穩定版本" -#: ../../tools/templates/dummy.html:38 +#: ../../tools/templates/dummy.html:39 msgid "security-fixes" msgstr "安全性修護" -#: ../../tools/templates/dummy.html:39 +#: ../../tools/templates/dummy.html:40 msgid "EOL" msgstr "停止維護" From f13323b6178206a58bae6461ad3c3d48b8e6f9d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 24 Apr 2026 00:30:46 +0000 Subject: [PATCH 4/4] sync with cpython 26c6e3d7 --- howto/free-threading-extensions.po | 23 +- library/re.po | 4 +- library/typing.po | 1257 ++++++++++++++-------------- 3 files changed, 644 insertions(+), 640 deletions(-) diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index fbb99717379..a8c1c4f5996 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-07 00:14+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+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-" @@ -672,23 +672,20 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:397 msgid "" "`pypa/manylinux `_ supports the free-" -"threaded build, with the ``t`` suffix, such as ``python3.13t``." +"threaded build, with the ``t`` suffix, such as ``python3.14t``." msgstr "" #: ../../howto/free-threading-extensions.rst:399 msgid "" -"`pypa/cibuildwheel `_ supports the " -"free-threaded build on Python 3.13 and 3.14. On Python 3.14, free-threaded " -"wheels will be built by default. On Python 3.13, you will need to set " -"`CIBW_ENABLE to cpython-freethreading `_." +"`pypa/cibuildwheel `_ supports " +"building wheels for the free-threaded build of Python 3.14 and newer." msgstr "" -#: ../../howto/free-threading-extensions.rst:405 +#: ../../howto/free-threading-extensions.rst:403 msgid "Limited C API and Stable ABI" msgstr "" -#: ../../howto/free-threading-extensions.rst:407 +#: ../../howto/free-threading-extensions.rst:405 msgid "" "The free-threaded build does not currently support the :ref:`Limited C API " "` or the stable ABI. If you use `setuptools `_: A community-maintained porting guide for " diff --git a/library/re.po b/library/re.po index 4e3f4634940..9ef686009f2 100644 --- a/library/re.po +++ b/library/re.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-22 00:18+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3042,7 +3042,7 @@ msgid "" "\n" "class Token(NamedTuple):\n" " type: str\n" -" value: str\n" +" value: int | float | str\n" " line: int\n" " column: int\n" "\n" diff --git a/library/typing.po b/library/typing.po index 08b1e84550f..b10c98af6f2 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: 2026-02-26 18:22+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+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-" @@ -389,8 +389,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3296 -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:215 ../../library/typing.rst:3297 +#: ../../library/typing.rst:3498 msgid "For example:" msgstr "舉例來說:" @@ -513,7 +513,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:287 ../../library/typing.rst:4025 +#: ../../library/typing.rst:287 ../../library/typing.rst:4029 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -1578,10 +1578,10 @@ msgstr "" "不可以將此兩種混合。" #: ../../library/typing.rst:873 ../../library/typing.rst:991 -#: ../../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:3233 ../../library/typing.rst:3479 +#: ../../library/typing.rst:1048 ../../library/typing.rst:1231 +#: ../../library/typing.rst:1318 ../../library/typing.rst:1360 +#: ../../library/typing.rst:1569 ../../library/typing.rst:1630 +#: ../../library/typing.rst:3234 ../../library/typing.rst:3483 msgid "For example::" msgstr "舉例來說: ::" @@ -1648,7 +1648,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:917 ../../library/typing.rst:2250 +#: ../../library/typing.rst:917 ../../library/typing.rst:2251 msgid "Example:" msgstr "舉例來說: ::" @@ -1983,7 +1983,7 @@ msgstr "單一引數的聯集會消失不見,舉例來說: ::" msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # 實際上建構函式會回傳 int" -#: ../../library/typing.rst:1116 ../../library/typing.rst:1260 +#: ../../library/typing.rst:1116 ../../library/typing.rst:1261 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" @@ -2080,14 +2080,16 @@ msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" #: ../../library/typing.rst:1172 +#, fuzzy msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " "adds, removes, or transforms parameters of another callable. Usage is in " "the form ``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. " -"``Concatenate`` is currently only valid when used as the first argument to " -"a :ref:`Callable `. The last parameter to " -"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." +"``Concatenate`` is valid when used in :ref:`Callable ` " +"type hints and when instantiating user-defined generic classes with :class:" +"`ParamSpec` parameters. The last parameter to ``Concatenate`` must be a :" +"class:`ParamSpec` or ellipsis (``...``)." msgstr "" "``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" "class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" @@ -2097,7 +2099,7 @@ msgstr "" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1181 +#: ../../library/typing.rst:1182 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -2113,7 +2115,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1189 +#: ../../library/typing.rst:1190 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -2141,32 +2143,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1217 ../../library/typing.rst:2218 +#: ../../library/typing.rst:1218 ../../library/typing.rst:2219 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1219 +#: ../../library/typing.rst:1220 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1220 ../../library/typing.rst:2221 +#: ../../library/typing.rst:1221 ../../library/typing.rst:2222 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1224 +#: ../../library/typing.rst:1225 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1226 +#: ../../library/typing.rst:1227 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1232 +#: ../../library/typing.rst:1233 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -2188,7 +2190,7 @@ msgstr "" "open_helper('/some/path', 'r') # 通過型別檢查\n" "open_helper('/other/path', 'typo') # 型別檢查器中的錯誤" -#: ../../library/typing.rst:1242 +#: ../../library/typing.rst:1243 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -2198,29 +2200,29 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1246 +#: ../../library/typing.rst:1247 msgid "Additional details:" msgstr "其他細節:" -#: ../../library/typing.rst:1248 +#: ../../library/typing.rst:1249 msgid "The arguments must be literal values and there must be at least one." msgstr "引數必須為文本值且必須有至少一個。" -#: ../../library/typing.rst:1250 +#: ../../library/typing.rst:1251 msgid "Nested ``Literal`` types are flattened, e.g.::" msgstr "巢狀的 ``Literal`` 會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1252 +#: ../../library/typing.rst:1253 msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -#: ../../library/typing.rst:1254 +#: ../../library/typing.rst:1255 msgid "" "However, this does not apply to ``Literal`` types referenced through a type " "alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1257 +#: ../../library/typing.rst:1258 msgid "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" @@ -2228,27 +2230,27 @@ msgstr "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" -#: ../../library/typing.rst:1262 +#: ../../library/typing.rst:1263 msgid "assert Literal[1, 2, 1] == Literal[1, 2]" msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" -#: ../../library/typing.rst:1264 +#: ../../library/typing.rst:1265 msgid "When comparing literals, the argument order is ignored, e.g.::" msgstr "當比較文本時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1266 +#: ../../library/typing.rst:1267 msgid "assert Literal[1, 2] == Literal[2, 1]" msgstr "assert Literal[1, 2] == Literal[2, 1]" -#: ../../library/typing.rst:1268 +#: ../../library/typing.rst:1269 msgid "You cannot subclass or instantiate a ``Literal``." msgstr "你不能建立 ``Literal`` 的子類別或是實例。" -#: ../../library/typing.rst:1270 +#: ../../library/typing.rst:1271 msgid "You cannot write ``Literal[X][Y]``." msgstr "你不能寫成 ``Literal[X][Y]``。" -#: ../../library/typing.rst:1274 +#: ../../library/typing.rst:1275 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -2259,11 +2261,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1282 +#: ../../library/typing.rst:1283 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1284 +#: ../../library/typing.rst:1285 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -2273,7 +2275,7 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1288 +#: ../../library/typing.rst:1289 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" @@ -2283,11 +2285,11 @@ msgstr "" " stats: ClassVar[dict[str, int]] = {} # 類別變數\n" " damage: int = 10 # 實例變數" -#: ../../library/typing.rst:1292 +#: ../../library/typing.rst:1293 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1294 +#: ../../library/typing.rst:1295 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -2299,22 +2301,22 @@ msgstr "" "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" "式碼為一個錯誤: ::" -#: ../../library/typing.rst:1300 +#: ../../library/typing.rst:1301 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1308 +#: ../../library/typing.rst:1309 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" -#: ../../library/typing.rst:1312 +#: ../../library/typing.rst:1313 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1315 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2322,7 +2324,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1319 +#: ../../library/typing.rst:1320 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2334,22 +2336,22 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1328 ../../library/typing.rst:3249 +#: ../../library/typing.rst:1329 ../../library/typing.rst:3250 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1335 +#: ../../library/typing.rst:1336 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" -#: ../../library/typing.rst:1339 +#: ../../library/typing.rst:1340 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1342 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -2357,23 +2359,23 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1348 +#: ../../library/typing.rst:1349 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1351 +#: ../../library/typing.rst:1352 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1357 +#: ../../library/typing.rst:1358 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" -#: ../../library/typing.rst:1361 +#: ../../library/typing.rst:1362 msgid "" "class Movie(TypedDict):\n" " title: ReadOnly[str]\n" @@ -2391,19 +2393,19 @@ msgstr "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # 型別檢查器錯誤" -#: ../../library/typing.rst:1369 +#: ../../library/typing.rst:1370 msgid "There is no runtime checking for this property." msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" -#: ../../library/typing.rst:1371 +#: ../../library/typing.rst:1372 msgid "See :class:`TypedDict` and :pep:`705` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" -#: ../../library/typing.rst:1377 +#: ../../library/typing.rst:1378 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1379 +#: ../../library/typing.rst:1380 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2411,7 +2413,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1384 +#: ../../library/typing.rst:1385 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2420,7 +2422,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1390 +#: ../../library/typing.rst:1391 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2430,7 +2432,7 @@ msgid "" "class." msgstr "" -#: ../../library/typing.rst:1397 +#: ../../library/typing.rst:1398 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2438,13 +2440,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1405 +#: ../../library/typing.rst:1406 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1408 +#: ../../library/typing.rst:1409 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2462,14 +2464,14 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1418 +#: ../../library/typing.rst:1419 msgid "" "The first argument to ``Annotated`` must be a valid type. Multiple metadata " "elements can be supplied as ``Annotated`` supports variadic arguments. The " "order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:1422 +#: ../../library/typing.rst:1423 msgid "" "@dataclass\n" "class ctype:\n" @@ -2489,20 +2491,20 @@ msgstr "" "\n" "assert a1 != a2 # 順序是有意義的" -#: ../../library/typing.rst:1431 +#: ../../library/typing.rst:1432 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1435 +#: ../../library/typing.rst:1436 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1438 +#: ../../library/typing.rst:1439 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2514,14 +2516,14 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1442 +#: ../../library/typing.rst:1443 msgid "" "However, this does not apply to ``Annotated`` types referenced through a " "type alias, to avoid forcing evaluation of the underlying :class:" "`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1445 +#: ../../library/typing.rst:1446 msgid "" "type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" "assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" @@ -2533,11 +2535,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1450 +#: ../../library/typing.rst:1451 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1453 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2547,11 +2549,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1456 +#: ../../library/typing.rst:1457 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1458 +#: ../../library/typing.rst:1459 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2565,11 +2567,11 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1470 +#: ../../library/typing.rst:1471 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1472 +#: ../../library/typing.rst:1473 msgid "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # NOT valid" @@ -2577,19 +2579,19 @@ msgstr "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # 無效" -#: ../../library/typing.rst:1474 +#: ../../library/typing.rst:1475 msgid "" "where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " "as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1477 +#: ../../library/typing.rst:1478 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1481 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2607,13 +2609,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1491 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1494 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2629,13 +2631,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1502 +#: ../../library/typing.rst:1503 msgid "" "If you want to retrieve the original type wrapped by ``Annotated``, use the :" "attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1506 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2647,11 +2649,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1513 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1514 +#: ../../library/typing.rst:1515 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2659,20 +2661,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1521 +#: ../../library/typing.rst:1522 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1523 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1529 ../../library/typing.rst:1613 +#: ../../library/typing.rst:1530 ../../library/typing.rst:1614 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1531 +#: ../../library/typing.rst:1532 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2680,7 +2682,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1536 +#: ../../library/typing.rst:1537 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2690,7 +2692,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1542 +#: ../../library/typing.rst:1543 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2702,7 +2704,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1551 +#: ../../library/typing.rst:1552 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type predicate. Such a function should use ``TypeIs[...]`` or :data:" @@ -2713,29 +2715,29 @@ msgid "" "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1560 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1562 ../../library/typing.rst:1623 +#: ../../library/typing.rst:1563 ../../library/typing.rst:1624 msgid "The return value is a boolean." msgstr "回傳值是一個布林值。" -#: ../../library/typing.rst:1563 +#: ../../library/typing.rst:1564 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1565 +#: ../../library/typing.rst:1566 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1570 +#: ../../library/typing.rst:1571 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2759,7 +2761,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1591 +#: ../../library/typing.rst:1592 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2768,27 +2770,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1597 +#: ../../library/typing.rst:1598 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1601 +#: ../../library/typing.rst:1602 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1605 +#: ../../library/typing.rst:1606 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1615 +#: ../../library/typing.rst:1616 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2796,25 +2798,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1620 +#: ../../library/typing.rst:1621 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1624 +#: ../../library/typing.rst:1625 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1628 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1631 +#: ../../library/typing.rst:1632 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2829,11 +2831,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1644 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "``TypeIs`` 和 ``TypeGuard`` 在以下幾個方面有所不同:" -#: ../../library/typing.rst:1645 +#: ../../library/typing.rst:1646 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2841,7 +2843,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1650 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2850,7 +2852,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1653 +#: ../../library/typing.rst:1654 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2858,18 +2860,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1662 +#: ../../library/typing.rst:1663 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1665 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1668 +#: ../../library/typing.rst:1669 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2877,7 +2879,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1673 +#: ../../library/typing.rst:1674 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2885,7 +2887,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1680 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2896,13 +2898,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1688 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1690 +#: ../../library/typing.rst:1691 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2915,23 +2917,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1700 +#: ../../library/typing.rst:1701 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1705 +#: ../../library/typing.rst:1706 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1708 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1711 +#: ../../library/typing.rst:1712 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2939,17 +2941,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1718 +#: ../../library/typing.rst:1719 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1720 +#: ../../library/typing.rst:1721 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1723 +#: ../../library/typing.rst:1724 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2961,17 +2963,17 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1728 +#: ../../library/typing.rst:1729 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1733 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1735 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2985,20 +2987,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1740 +#: ../../library/typing.rst:1741 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1743 +#: ../../library/typing.rst:1744 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1749 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -3016,18 +3018,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1760 +#: ../../library/typing.rst:1761 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1762 +#: ../../library/typing.rst:1763 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1767 +#: ../../library/typing.rst:1768 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -3035,13 +3037,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1770 +#: ../../library/typing.rst:1771 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1773 +#: ../../library/typing.rst:1774 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -3052,13 +3054,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1780 +#: ../../library/typing.rst:1781 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1782 +#: ../../library/typing.rst:1783 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" @@ -3068,7 +3070,7 @@ msgstr "" "S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" "A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1786 +#: ../../library/typing.rst:1787 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -3076,7 +3078,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1793 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -3094,13 +3096,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1808 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1810 +#: ../../library/typing.rst:1811 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -3110,14 +3112,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1818 +#: ../../library/typing.rst:1819 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1822 +#: ../../library/typing.rst:1823 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -3131,13 +3133,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1834 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1836 +#: ../../library/typing.rst:1837 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -3148,13 +3150,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1845 +#: ../../library/typing.rst:1846 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1848 +#: ../../library/typing.rst:1849 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -3167,39 +3169,39 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1857 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1860 +#: ../../library/typing.rst:1861 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1865 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:1869 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1872 +#: ../../library/typing.rst:1873 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1878 +#: ../../library/typing.rst:1879 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1882 +#: ../../library/typing.rst:1883 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:1889 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " "attribute. When called directly, this method supports only the :attr:" @@ -3209,18 +3211,18 @@ msgid "" "in a different format." msgstr "" -#: ../../library/typing.rst:1898 +#: ../../library/typing.rst:1899 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1903 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1908 +#: ../../library/typing.rst:1909 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__constraints__` attribute. When called directly, this method supports only " @@ -3230,13 +3232,13 @@ msgid "" "to evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:1918 +#: ../../library/typing.rst:1919 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:1926 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__default__` attribute. When called directly, this method supports only the :" @@ -3246,7 +3248,7 @@ msgid "" "the value in a different format." msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:1936 msgid "" "Return whether or not the type variable has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3254,31 +3256,31 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1944 +#: ../../library/typing.rst:1945 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1950 ../../library/typing.rst:2099 -#: ../../library/typing.rst:2211 +#: ../../library/typing.rst:1951 ../../library/typing.rst:2100 +#: ../../library/typing.rst:2212 msgid "Support for default values was added." msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1956 +#: ../../library/typing.rst:1957 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1959 +#: ../../library/typing.rst:1960 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1962 +#: ../../library/typing.rst:1963 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3288,11 +3290,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1965 +#: ../../library/typing.rst:1966 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1967 +#: ../../library/typing.rst:1968 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3306,7 +3308,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1974 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3314,7 +3316,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1978 +#: ../../library/typing.rst:1979 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3334,7 +3336,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:1996 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3344,13 +3346,13 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:2003 +#: ../../library/typing.rst:2004 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:2006 +#: ../../library/typing.rst:2007 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" @@ -3360,13 +3362,13 @@ msgstr "" "x: tuple[Ts] # 無效\n" "x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:2010 +#: ../../library/typing.rst:2011 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2014 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3378,12 +3380,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:2018 +#: ../../library/typing.rst:2019 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:2020 +#: ../../library/typing.rst:2021 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3398,13 +3400,13 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:2034 +#: ../../library/typing.rst:2035 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:2037 +#: ../../library/typing.rst:2038 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" @@ -3414,13 +3416,13 @@ msgstr "" "class Array[*Shape, *Shape]: # 無效\n" " pass" -#: ../../library/typing.rst:2041 +#: ../../library/typing.rst:2042 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:2044 +#: ../../library/typing.rst:2045 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3436,7 +3438,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2052 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3445,21 +3447,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2059 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2063 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2067 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2073 +#: ../../library/typing.rst:2074 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVarTuple." "__default__` attribute. When called directly, this method supports only the :" @@ -3469,7 +3471,7 @@ msgid "" "evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:2083 +#: ../../library/typing.rst:2084 msgid "" "Return whether or not the type variable tuple has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3477,39 +3479,39 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2094 +#: ../../library/typing.rst:2095 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2103 +#: ../../library/typing.rst:2104 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2106 +#: ../../library/typing.rst:2107 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2110 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2111 +#: ../../library/typing.rst:2112 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2114 +#: ../../library/typing.rst:2115 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2117 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3519,7 +3521,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2124 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3527,7 +3529,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2128 +#: ../../library/typing.rst:2129 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3545,27 +3547,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2144 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2147 +#: ../../library/typing.rst:2148 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2150 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2157 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3578,17 +3580,17 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2168 +#: ../../library/typing.rst:2169 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2173 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2179 +#: ../../library/typing.rst:2180 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~ParamSpec." "__default__` attribute. When called directly, this method supports only the :" @@ -3598,7 +3600,7 @@ msgid "" "the value in a different format." msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2190 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" @@ -3606,7 +3608,7 @@ msgid "" "the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2196 +#: ../../library/typing.rst:2197 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3615,23 +3617,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:2206 +#: ../../library/typing.rst:2207 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2214 +#: ../../library/typing.rst:2215 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2220 +#: ../../library/typing.rst:2221 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2226 +#: ../../library/typing.rst:2227 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3639,13 +3641,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2231 +#: ../../library/typing.rst:2232 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2234 +#: ../../library/typing.rst:2235 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3661,11 +3663,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2248 +#: ../../library/typing.rst:2249 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2253 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3675,11 +3677,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2262 +#: ../../library/typing.rst:2263 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2264 +#: ../../library/typing.rst:2265 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3689,11 +3691,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2272 +#: ../../library/typing.rst:2273 msgid "The name of the module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2275 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3703,13 +3705,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2280 +#: ../../library/typing.rst:2281 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2283 +#: ../../library/typing.rst:2284 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3725,14 +3727,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2294 +#: ../../library/typing.rst:2295 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2298 +#: ../../library/typing.rst:2299 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3756,7 +3758,7 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2313 +#: ../../library/typing.rst:2314 msgid "" "An :term:`evaluate function` corresponding to the :attr:`__value__` " "attribute. When called directly, this method supports only the :attr:" @@ -3766,7 +3768,7 @@ msgid "" "different format:" msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2320 msgid "" ">>> type Alias = undefined\n" ">>> Alias.__value__\n" @@ -3794,17 +3796,17 @@ msgstr "" ">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" "ForwardRef('undefined')" -#: ../../library/typing.rst:2337 +#: ../../library/typing.rst:2338 msgid "Unpacking" msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2339 msgid "" "Type aliases support star unpacking using the ``*Alias`` syntax. This is " "equivalent to using ``Unpack[Alias]`` directly:" msgstr "" -#: ../../library/typing.rst:2341 +#: ../../library/typing.rst:2342 msgid "" ">>> type Alias = tuple[int, str]\n" ">>> type Unpacked = tuple[bool, *Alias]\n" @@ -3816,27 +3818,27 @@ msgstr "" ">>> Unpacked.__value__\n" "tuple[bool, typing.Unpack[Alias]]" -#: ../../library/typing.rst:2352 +#: ../../library/typing.rst:2353 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2354 +#: ../../library/typing.rst:2355 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2360 +#: ../../library/typing.rst:2361 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2362 ../../library/typing.rst:2462 -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:2363 ../../library/typing.rst:2463 +#: ../../library/typing.rst:3587 msgid "Usage::" msgstr "用法: ::" -#: ../../library/typing.rst:2364 +#: ../../library/typing.rst:2365 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3846,20 +3848,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2368 +#: ../../library/typing.rst:2369 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2370 +#: ../../library/typing.rst:2371 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2373 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2375 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3875,12 +3877,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2382 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2383 +#: ../../library/typing.rst:2384 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3889,11 +3891,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2389 +#: ../../library/typing.rst:2390 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2391 +#: ../../library/typing.rst:2392 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3904,11 +3906,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2399 +#: ../../library/typing.rst:2400 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2401 +#: ../../library/typing.rst:2402 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3918,11 +3920,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2405 +#: ../../library/typing.rst:2406 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2407 +#: ../../library/typing.rst:2408 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3935,51 +3937,51 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2417 +#: ../../library/typing.rst:2418 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2420 +#: ../../library/typing.rst:2421 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2423 +#: ../../library/typing.rst:2424 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2427 +#: ../../library/typing.rst:2428 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2431 +#: ../../library/typing.rst:2432 msgid "" "``NamedTuple`` is now a function rather than a class. It can still be used " "as a class base, as described above." msgstr "" -#: ../../library/typing.rst:2435 +#: ../../library/typing.rst:2436 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2438 +#: ../../library/typing.rst:2439 msgid "" "Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " "methods of ``NamedTuple`` subclasses is unsupported and causes a :class:" "`TypeError`." msgstr "" -#: ../../library/typing.rst:2442 +#: ../../library/typing.rst:2443 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2447 +#: ../../library/typing.rst:2448 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3989,48 +3991,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2458 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2459 +#: ../../library/typing.rst:2460 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2464 +#: ../../library/typing.rst:2465 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2469 +#: ../../library/typing.rst:2470 msgid "The name of the module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2473 +#: ../../library/typing.rst:2474 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2477 +#: ../../library/typing.rst:2478 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2481 +#: ../../library/typing.rst:2482 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2487 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2489 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2490 +#: ../../library/typing.rst:2491 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -4040,13 +4042,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2494 +#: ../../library/typing.rst:2495 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2497 +#: ../../library/typing.rst:2498 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -4058,7 +4060,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2506 +#: ../../library/typing.rst:2507 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -4067,11 +4069,11 @@ msgid "" "second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2513 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2514 +#: ../../library/typing.rst:2515 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -4081,13 +4083,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2518 +#: ../../library/typing.rst:2519 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2521 +#: ../../library/typing.rst:2522 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4101,11 +4103,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2532 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2533 +#: ../../library/typing.rst:2534 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This allows a simple-minded structural check, very similar to \"one trick " @@ -4113,7 +4115,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2537 +#: ../../library/typing.rst:2538 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -4141,12 +4143,12 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2551 msgid "" "This decorator raises :exc:`TypeError` when applied to a non-protocol class." msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2555 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -4157,7 +4159,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2565 +#: ../../library/typing.rst:2566 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -4165,7 +4167,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2573 +#: ../../library/typing.rst:2574 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -4175,7 +4177,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2582 +#: ../../library/typing.rst:2583 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -4184,13 +4186,13 @@ msgid "" "`What's new in Python 3.12 ` for more details." msgstr "" -#: ../../library/typing.rst:2593 +#: ../../library/typing.rst:2594 msgid "" "Special construct to add type hints to a dictionary. At runtime \":class:`!" "TypedDict` instances\" are simply :class:`dicts `." msgstr "" -#: ../../library/typing.rst:2596 +#: ../../library/typing.rst:2597 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -4198,7 +4200,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2602 +#: ../../library/typing.rst:2603 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4211,17 +4213,17 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2612 +#: ../../library/typing.rst:2613 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2615 +#: ../../library/typing.rst:2616 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2618 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " @@ -4229,7 +4231,7 @@ msgid "" "mangling>` like regular private names::" msgstr "" -#: ../../library/typing.rst:2622 +#: ../../library/typing.rst:2623 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -4244,13 +4246,13 @@ msgid "" "Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2634 +#: ../../library/typing.rst:2635 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2637 +#: ../../library/typing.rst:2638 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4270,19 +4272,19 @@ msgstr "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" -#: ../../library/typing.rst:2645 +#: ../../library/typing.rst:2646 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2648 +#: ../../library/typing.rst:2649 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2651 +#: ../../library/typing.rst:2652 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -4298,7 +4300,7 @@ msgstr "" "# 替代語法\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2658 +#: ../../library/typing.rst:2659 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -4306,13 +4308,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2663 +#: ../../library/typing.rst:2664 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2666 +#: ../../library/typing.rst:2667 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -4338,13 +4340,13 @@ msgstr "" " 'label': str\n" "}, total=False)" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2679 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2682 +#: ../../library/typing.rst:2683 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -4352,13 +4354,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2685 +#: ../../library/typing.rst:2686 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2688 +#: ../../library/typing.rst:2689 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -4370,13 +4372,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2693 +#: ../../library/typing.rst:2694 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2696 +#: ../../library/typing.rst:2697 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -4402,11 +4404,11 @@ msgstr "" "\n" "class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2709 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2710 +#: ../../library/typing.rst:2711 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -4416,13 +4418,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2714 +#: ../../library/typing.rst:2715 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2718 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4436,19 +4438,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2725 +#: ../../library/typing.rst:2726 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2731 +#: ../../library/typing.rst:2732 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2734 +#: ../../library/typing.rst:2735 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4472,7 +4474,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2748 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4483,21 +4485,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2760 +#: ../../library/typing.rst:2761 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2764 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2766 +#: ../../library/typing.rst:2767 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4506,7 +4508,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2773 +#: ../../library/typing.rst:2774 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4532,7 +4534,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2791 +#: ../../library/typing.rst:2792 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4541,56 +4543,56 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:2798 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2802 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2809 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2813 +#: ../../library/typing.rst:2814 msgid "" "See the `TypedDict `_ section in the typing documentation for more examples and " "detailed rules." msgstr "" -#: ../../library/typing.rst:2817 +#: ../../library/typing.rst:2818 msgid "" "``TypedDict`` is now a function rather than a class. It can still be used as " "a class base, as described above." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2822 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2825 +#: ../../library/typing.rst:2826 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2828 +#: ../../library/typing.rst:2829 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:2832 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2835 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4600,53 +4602,53 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2843 +#: ../../library/typing.rst:2844 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2845 +#: ../../library/typing.rst:2846 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " "decorated with :deco:`runtime_checkable`." msgstr "" -#: ../../library/typing.rst:2850 +#: ../../library/typing.rst:2851 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2855 +#: ../../library/typing.rst:2856 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2859 +#: ../../library/typing.rst:2860 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2864 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2868 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2873 +#: ../../library/typing.rst:2874 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:2878 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:2884 msgid "ABCs and Protocols for working with I/O" msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:2890 msgid "" "Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " @@ -4654,14 +4656,14 @@ msgid "" "interface is fairly broad." msgstr "" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2896 msgid "" "The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " "alternative for argument types, when only the ``read()`` or ``write()`` " "methods are accessed, respectively::" msgstr "" -#: ../../library/typing.rst:2899 +#: ../../library/typing.rst:2900 msgid "" "def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" " data = reader.read()\n" @@ -4671,13 +4673,13 @@ msgstr "" " data = reader.read()\n" " writer.write(data.encode())" -#: ../../library/typing.rst:2903 +#: ../../library/typing.rst:2904 msgid "" "Also consider using :class:`collections.abc.Iterable` for iterating over the " "lines of an input stream::" msgstr "" -#: ../../library/typing.rst:2906 +#: ../../library/typing.rst:2907 msgid "" "def read_config(stream: Iterable[str]):\n" " for line in stream:\n" @@ -4687,40 +4689,40 @@ msgstr "" " for line in stream:\n" " ..." -#: ../../library/typing.rst:2911 +#: ../../library/typing.rst:2912 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2915 +#: ../../library/typing.rst:2916 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2917 +#: ../../library/typing.rst:2918 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2924 +#: ../../library/typing.rst:2925 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2926 +#: ../../library/typing.rst:2927 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2929 +#: ../../library/typing.rst:2930 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2932 +#: ../../library/typing.rst:2933 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" @@ -4730,13 +4732,13 @@ msgstr "" " assert_type(name, str) # OK,推斷出的 `name` 型別是 `str`\n" " assert_type(name, int) # 型別檢查器錯誤" -#: ../../library/typing.rst:2936 +#: ../../library/typing.rst:2937 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2939 +#: ../../library/typing.rst:2940 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4746,16 +4748,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2950 +#: ../../library/typing.rst:2951 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2952 +#: ../../library/typing.rst:2953 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:2955 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4775,14 +4777,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2963 +#: ../../library/typing.rst:2964 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2968 +#: ../../library/typing.rst:2969 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4792,47 +4794,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2976 +#: ../../library/typing.rst:2977 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:2980 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " "checking with static typing." msgstr "" -#: ../../library/typing.rst:2987 +#: ../../library/typing.rst:2988 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2989 +#: ../../library/typing.rst:2990 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2992 +#: ../../library/typing.rst:2993 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2995 +#: ../../library/typing.rst:2996 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2998 +#: ../../library/typing.rst:2999 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:3002 +#: ../../library/typing.rst:3003 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4840,13 +4842,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:3005 +#: ../../library/typing.rst:3006 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3009 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4854,13 +4856,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:3019 +#: ../../library/typing.rst:3020 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:3022 +#: ../../library/typing.rst:3023 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4869,11 +4871,11 @@ msgid "" "to :deco:`dataclasses.dataclass`." msgstr "" -#: ../../library/typing.rst:3029 +#: ../../library/typing.rst:3030 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3032 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4895,11 +4897,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3043 +#: ../../library/typing.rst:3044 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:3045 +#: ../../library/typing.rst:3046 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4915,11 +4917,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3053 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:3054 +#: ../../library/typing.rst:3055 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4939,7 +4941,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3063 +#: ../../library/typing.rst:3064 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :deco:`dataclasses.dataclass`. For " @@ -4947,7 +4949,7 @@ msgid "" "that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:3069 +#: ../../library/typing.rst:3070 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 " @@ -4957,7 +4959,7 @@ msgid "" "``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:3077 +#: ../../library/typing.rst:3078 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4968,90 +4970,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:3081 +#: ../../library/typing.rst:3082 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3087 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3091 +#: ../../library/typing.rst:3092 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3096 +#: ../../library/typing.rst:3097 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:3097 +#: ../../library/typing.rst:3098 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3103 +#: ../../library/typing.rst:3104 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:3109 +#: ../../library/typing.rst:3110 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:3113 +#: ../../library/typing.rst:3114 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:3116 +#: ../../library/typing.rst:3117 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3121 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:3121 +#: ../../library/typing.rst:3122 msgid "Description" msgstr "" -#: ../../library/typing.rst:3122 +#: ../../library/typing.rst:3123 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3124 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3126 +#: ../../library/typing.rst:3127 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:3127 +#: ../../library/typing.rst:3128 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:3128 +#: ../../library/typing.rst:3129 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3130 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -5059,19 +5061,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:3134 +#: ../../library/typing.rst:3135 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:3135 +#: ../../library/typing.rst:3136 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:3136 +#: ../../library/typing.rst:3137 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:3137 +#: ../../library/typing.rst:3138 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -5081,32 +5083,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:3143 +#: ../../library/typing.rst:3144 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3145 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3148 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: ../../library/typing.rst:3151 +#: ../../library/typing.rst:3152 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:3159 +#: ../../library/typing.rst:3160 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3162 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -5114,7 +5116,7 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3167 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " @@ -5124,13 +5126,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3175 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: ../../library/typing.rst:3177 +#: ../../library/typing.rst:3178 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -5156,22 +5158,22 @@ msgstr "" "def process(response):\n" " ... # 實際的實作在這邊" -#: ../../library/typing.rst:3191 +#: ../../library/typing.rst:3192 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3194 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:3200 +#: ../../library/typing.rst:3201 msgid "Return a sequence of :deco:`overload`-decorated definitions for *func*." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3204 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -5181,32 +5183,32 @@ msgid "" "sequence." msgstr "" -#: ../../library/typing.rst:3210 +#: ../../library/typing.rst:3211 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3219 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3221 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3227 +#: ../../library/typing.rst:3228 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3230 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3235 +#: ../../library/typing.rst:3236 msgid "" "class Base:\n" " @final\n" @@ -5236,7 +5238,7 @@ msgstr "" "class Other(Leaf): # 型別檢查器回報的錯誤\n" " ..." -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3255 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -5246,11 +5248,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3265 +#: ../../library/typing.rst:3266 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3267 +#: ../../library/typing.rst:3268 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -5258,40 +5260,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3273 +#: ../../library/typing.rst:3274 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3278 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3280 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3282 +#: ../../library/typing.rst:3283 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3288 +#: ../../library/typing.rst:3289 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3291 +#: ../../library/typing.rst:3292 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3298 +#: ../../library/typing.rst:3299 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -5307,11 +5309,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3313 +#: ../../library/typing.rst:3314 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3315 +#: ../../library/typing.rst:3316 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -5321,22 +5323,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3322 +#: ../../library/typing.rst:3323 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3330 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3331 +#: ../../library/typing.rst:3332 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3335 +#: ../../library/typing.rst:3336 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -5346,29 +5348,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3342 +#: ../../library/typing.rst:3343 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3347 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3350 +#: ../../library/typing.rst:3351 msgid "" "Return a dictionary containing type hints for a function, method, module, " "class object, or other callable object." msgstr "" -#: ../../library/typing.rst:3353 +#: ../../library/typing.rst:3354 msgid "" -"This is often the same as ``obj.__annotations__``, but this function makes " -"the following changes to the annotations dictionary:" +"This is often the same as :func:`annotationlib.get_annotations`, but this " +"function makes the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3356 +#: ../../library/typing.rst:3357 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -5377,27 +5379,28 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3362 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3362 +#: ../../library/typing.rst:3363 msgid "" "If :deco:`no_type_check` has been applied to *obj*, an empty dictionary is " "returned." msgstr "" -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:3365 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " "done by traversing :attr:`C.__mro__ ` and iteratively " -"combining ``__annotations__`` dictionaries. Annotations on classes appearing " -"earlier in the :term:`method resolution order` always take precedence over " -"annotations on classes appearing later in the method resolution order." +"combining :term:`annotations ` of each base class. " +"Annotations on classes appearing earlier in the :term:`method resolution " +"order` always take precedence over annotations on classes appearing later in " +"the method resolution order." msgstr "" -#: ../../library/typing.rst:3371 +#: ../../library/typing.rst:3373 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]``, " "``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]`` with ``T``, unless " @@ -5405,25 +5408,20 @@ msgid "" "information)." msgstr "" -#: ../../library/typing.rst:3376 -msgid "" -"See also :func:`annotationlib.get_annotations`, a lower-level function that " -"returns annotations more directly." -msgstr "" - -#: ../../library/typing.rst:3381 ../../library/typing.rst:3544 +#: ../../library/typing.rst:3380 ../../library/typing.rst:3548 msgid "" "This function may execute arbitrary code contained in annotations. See :ref:" "`annotationlib-security` for more information." msgstr "" -#: ../../library/typing.rst:3386 +#: ../../library/typing.rst:3385 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 :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " -"aliases ` that include forward references, or with names " -"imported under :data:`if TYPE_CHECKING `." +"If :attr:`Format.VALUE ` is used and any forward " +"references in the annotations of *obj* are not resolvable, a :exc:" +"`NameError` exception is raised. For example, this can happen with names " +"imported under :data:`if TYPE_CHECKING `. More generally, any " +"kind of exception can be raised if an annotation contains invalid Python " +"code." msgstr "" #: ../../library/typing.rst:3394 @@ -5449,19 +5447,28 @@ msgid "" msgstr "" #: ../../library/typing.rst:3408 +#, fuzzy +msgid "" +"Added the ``format`` parameter. See the documentation on :func:" +"`annotationlib.get_annotations` for more information." +msgstr "" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" +"`Annotated` 的文件。" + +#: ../../library/typing.rst:3412 msgid "" "Calling :func:`get_type_hints` on instances is no longer supported. Some " "instances were accepted in earlier versions as an undocumented " "implementation detail." msgstr "" -#: ../../library/typing.rst:3415 +#: ../../library/typing.rst:3419 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3418 +#: ../../library/typing.rst:3422 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 :" @@ -5469,11 +5476,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3424 ../../library/typing.rst:3448 +#: ../../library/typing.rst:3428 ../../library/typing.rst:3452 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3430 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5491,13 +5498,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3440 +#: ../../library/typing.rst:3444 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:3443 +#: ../../library/typing.rst:3447 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 " @@ -5505,7 +5512,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3454 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5515,11 +5522,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3460 +#: ../../library/typing.rst:3464 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3462 +#: ../../library/typing.rst:3466 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5535,15 +5542,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3475 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3477 +#: ../../library/typing.rst:3481 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3481 +#: ../../library/typing.rst:3485 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5559,11 +5566,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3496 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3496 +#: ../../library/typing.rst:3500 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5577,57 +5584,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3513 +#: ../../library/typing.rst:3517 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3519 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:3520 +#: ../../library/typing.rst:3524 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:3526 +#: ../../library/typing.rst:3530 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:3533 +#: ../../library/typing.rst:3537 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3539 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:3539 +#: ../../library/typing.rst:3543 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:3551 +#: ../../library/typing.rst:3555 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3558 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5643,17 +5650,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3566 +#: ../../library/typing.rst:3570 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3570 +#: ../../library/typing.rst:3574 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:3573 +#: ../../library/typing.rst:3577 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:`` " @@ -5665,7 +5672,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3589 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5679,7 +5686,7 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3591 +#: ../../library/typing.rst:3595 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5688,11 +5695,11 @@ msgid "" "raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3608 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3610 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5701,7 +5708,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3617 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 " @@ -5709,7 +5716,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3618 +#: ../../library/typing.rst:3622 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 " @@ -5717,38 +5724,38 @@ msgid "" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3623 +#: ../../library/typing.rst:3627 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:3629 +#: ../../library/typing.rst:3633 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3633 +#: ../../library/typing.rst:3637 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3639 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:3639 +#: ../../library/typing.rst:3643 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3645 +#: ../../library/typing.rst:3649 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3647 +#: ../../library/typing.rst:3651 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5756,136 +5763,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3652 +#: ../../library/typing.rst:3656 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3662 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3664 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:3664 +#: ../../library/typing.rst:3668 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3674 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3672 +#: ../../library/typing.rst:3676 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3679 +#: ../../library/typing.rst:3683 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3681 +#: ../../library/typing.rst:3685 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3684 +#: ../../library/typing.rst:3688 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3690 +#: ../../library/typing.rst:3694 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3692 +#: ../../library/typing.rst:3696 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3697 +#: ../../library/typing.rst:3701 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3704 +#: ../../library/typing.rst:3708 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3708 +#: ../../library/typing.rst:3712 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3712 +#: ../../library/typing.rst:3716 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3718 +#: ../../library/typing.rst:3722 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3722 +#: ../../library/typing.rst:3726 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3732 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3732 +#: ../../library/typing.rst:3736 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3742 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3746 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3752 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3756 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3759 +#: ../../library/typing.rst:3763 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3764 +#: ../../library/typing.rst:3768 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3767 +#: ../../library/typing.rst:3771 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5893,29 +5900,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3772 +#: ../../library/typing.rst:3776 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3778 +#: ../../library/typing.rst:3782 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3780 +#: ../../library/typing.rst:3784 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:3784 +#: ../../library/typing.rst:3788 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:3787 +#: ../../library/typing.rst:3791 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5923,32 +5930,32 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3792 +#: ../../library/typing.rst:3796 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:3802 +#: ../../library/typing.rst:3806 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3810 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3808 +#: ../../library/typing.rst:3812 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3818 msgid "Deprecated alias to :class:`collections.abc.ByteString`." msgstr "棄用 :class:`collections.abc.ByteString` 的別名。" -#: ../../library/typing.rst:3816 +#: ../../library/typing.rst:3820 msgid "" "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " "implements the :ref:`buffer protocol ` at runtime. For use in " @@ -5961,7 +5968,7 @@ msgstr "" "用 :class:`~collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例" "如 ``bytes | bytearray | memoryview``)。" -#: ../../library/typing.rst:3822 +#: ../../library/typing.rst:3826 msgid "" ":class:`!ByteString` was originally intended to be an abstract class that " "would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " @@ -5977,286 +5984,286 @@ msgstr "" "其他常見的緩衝區型別如 :class:`memoryview` 也從未被理解為 :class:`!" "ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" -#: ../../library/typing.rst:3830 +#: ../../library/typing.rst:3834 msgid "See :pep:`PEP 688 <688#current-options>` for more details." msgstr "更多細節請見 :pep:`PEP 688 <688#current-options>`。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3840 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3840 +#: ../../library/typing.rst:3844 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3850 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3848 +#: ../../library/typing.rst:3852 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3854 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3856 +#: ../../library/typing.rst:3860 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3866 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3864 +#: ../../library/typing.rst:3868 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3870 +#: ../../library/typing.rst:3874 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3872 +#: ../../library/typing.rst:3876 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3878 +#: ../../library/typing.rst:3882 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3880 +#: ../../library/typing.rst:3884 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3886 +#: ../../library/typing.rst:3890 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3888 +#: ../../library/typing.rst:3892 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3899 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3897 +#: ../../library/typing.rst:3901 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3904 +#: ../../library/typing.rst:3908 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3906 +#: ../../library/typing.rst:3910 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3916 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3918 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3924 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3922 +#: ../../library/typing.rst:3926 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:3933 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3933 +#: ../../library/typing.rst:3937 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3935 +#: ../../library/typing.rst:3939 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:3941 +#: ../../library/typing.rst:3945 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3947 +#: ../../library/typing.rst:3951 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3949 +#: ../../library/typing.rst:3953 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:3955 +#: ../../library/typing.rst:3959 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3960 +#: ../../library/typing.rst:3964 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3965 +#: ../../library/typing.rst:3969 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3969 +#: ../../library/typing.rst:3973 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3975 +#: ../../library/typing.rst:3979 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3979 +#: ../../library/typing.rst:3983 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3985 +#: ../../library/typing.rst:3989 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3989 +#: ../../library/typing.rst:3993 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4000 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:4000 +#: ../../library/typing.rst:4004 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:4002 +#: ../../library/typing.rst:4006 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4008 +#: ../../library/typing.rst:4012 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:4010 +#: ../../library/typing.rst:4014 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4016 +#: ../../library/typing.rst:4020 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:4018 +#: ../../library/typing.rst:4022 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:4021 +#: ../../library/typing.rst:4025 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4031 +#: ../../library/typing.rst:4035 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:4033 +#: ../../library/typing.rst:4037 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:4037 +#: ../../library/typing.rst:4041 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4041 +#: ../../library/typing.rst:4045 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:4046 +#: ../../library/typing.rst:4050 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:4048 +#: ../../library/typing.rst:4052 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4053 +#: ../../library/typing.rst:4057 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4055 +#: ../../library/typing.rst:4059 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4061 +#: ../../library/typing.rst:4065 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4063 +#: ../../library/typing.rst:4067 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4069 +#: ../../library/typing.rst:4073 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4073 +#: ../../library/typing.rst:4077 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4079 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -6264,21 +6271,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4082 +#: ../../library/typing.rst:4086 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4087 +#: ../../library/typing.rst:4091 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4092 +#: ../../library/typing.rst:4096 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4094 +#: ../../library/typing.rst:4098 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6286,21 +6293,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4101 +#: ../../library/typing.rst:4105 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4106 +#: ../../library/typing.rst:4110 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4110 +#: ../../library/typing.rst:4114 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4112 +#: ../../library/typing.rst:4116 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6308,112 +6315,112 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4119 +#: ../../library/typing.rst:4123 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4120 +#: ../../library/typing.rst:4124 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4121 +#: ../../library/typing.rst:4125 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4122 +#: ../../library/typing.rst:4126 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4123 +#: ../../library/typing.rst:4127 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 +#: ../../library/typing.rst:4128 ../../library/typing.rst:4132 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4125 +#: ../../library/typing.rst:4129 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4126 +#: ../../library/typing.rst:4130 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4127 +#: ../../library/typing.rst:4131 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:4129 +#: ../../library/typing.rst:4133 msgid "3.17" msgstr "3.17" -#: ../../library/typing.rst:4130 +#: ../../library/typing.rst:4134 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:4131 +#: ../../library/typing.rst:4135 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4132 +#: ../../library/typing.rst:4136 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4133 ../../library/typing.rst:4137 -#: ../../library/typing.rst:4141 +#: ../../library/typing.rst:4137 ../../library/typing.rst:4141 +#: ../../library/typing.rst:4145 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4134 +#: ../../library/typing.rst:4138 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4135 +#: ../../library/typing.rst:4139 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4136 ../../library/typing.rst:4140 +#: ../../library/typing.rst:4140 ../../library/typing.rst:4144 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4138 +#: ../../library/typing.rst:4142 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4139 +#: ../../library/typing.rst:4143 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4142 +#: ../../library/typing.rst:4146 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4143 +#: ../../library/typing.rst:4147 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4144 ../../library/typing.rst:4148 +#: ../../library/typing.rst:4148 ../../library/typing.rst:4152 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4145 +#: ../../library/typing.rst:4149 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4146 +#: ../../library/typing.rst:4150 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4147 +#: ../../library/typing.rst:4151 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4149 +#: ../../library/typing.rst:4153 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4150 +#: ../../library/typing.rst:4154 msgid ":gh:`105578`" msgstr ":gh:`105578`"